+
+ /*
+ **********************************
+ * Embed a generic <object ... <embed ... video
+ **********************************
+ */
+ } else {
+
+ /* Grab the contents of the webpage used to display the video */
+ list ($successfullyCopied, $contents, $response, $headers) =
+ GalleryCoreApi::fetchWebPage($url, $extraHeaders);
+ if (!$successfullyCopied) {
+ return array(GalleryCoreApi::error(ERROR_BAD_PATH,__FILE__,__LINE__,
+ "Unable to get video information at url: $url - $response"),NULL,NULL);
+ }
+
+ /* Extract the URL base (site name) */
+ preg_match("/(http:\/\/.+?)\//i",$url,$matches);
+ $site = $matches[1];
+ print "site: $site<br>";
+
+ /* Extract the summary from the webpage contents */
+ $summary="Unknown";
+ if(preg_match('/<meta name="description" content="(.+?)"/si', $contents, $matches)) {
+ $summary=$matches[1];
+ }
+
+ /* Extract the title from the webpage contents */
+ $title="Unknown";
+ if(preg_match('/<title>(.+?)<\/title>/i', $contents, $matches)) {
+ $title=$matches[1];
+ }
+
+ /*
+ * Set the thumbnail to some generic jpg image,
+ * since we can't extract it from a generic website.
+ * If no parameter is set, set it to a default value.
+ */
+ if(preg_match("/\w+/", $flvThumbnail)) {
+ $thumbnail = $flvThumbnail;
+ } else {
+ $thumbnail = $gallery2_url.$gallery2_flv_thumbnail;
+ }
+
+ /* Format the description to hold a reference to the embedded video */
+ if(preg_match('/(<object.+?<embed.+?<\/object>)/', $contents, $matches)) {
+ $description=$matches[1];
+ if(!strcmp($useRemoteSize,"false")) {
+ $description=preg_replace("/width=\"\d+\"/","width=\"".$width."\"",$description);
+ $description=preg_replace("/height=\"\d+\"/","height=\"".$height."\"",$description);
+ }
+ $description=preg_replace("/src=\"\//","src=\"".$site."\/",$description);
+ } else {
+ $unsupported_url=1;
+ }
+ }
+