$myspaceUrlPattern="vids.myspace.com";
$myspaceUrlPattern2="myspacetv.com";
$myspaceThumbnailUrl="http://mediaservices.myspace.com/services/rss.ashx?type=video&videoID=";
+
+ /* vimeo */
+ $vimeoUrlPattern="www.vimeo.com";
/* Gallery2 specific paths and variables */
$urlGenerator =& $gallery->getUrlGenerator();
return array(GalleryCoreApi::error(ERROR_BAD_PATH,__FILE__,__LINE__,
"Unable to extract embedded video information from url: $url"),NULL,NULL);
}
-
+
+ /*
+ **********************************
+ * Embed a Vimeo Video
+ **********************************
+ */
+ } else if(preg_match("/$vimeoUrlPattern/",$url)) {
+
+ /* Make sure we can extract a docID */
+ if(preg_match("/$vimeoUrlPattern\/(.*)/",$url,$matches)) {
+ $video_id = $matches[1];
+ } else {
+ return array(GalleryCoreApi::error(ERROR_BAD_PARAMETER,__FILE__,__LINE__,
+ "Unable to extract video id from url: $url"),null,null);
+ }
+
+ /* Grab the contents of the webpage used to display the video on video.google.com */
+ 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 summary from the webpage contents */
+ preg_match('/<meta name="description" content="(.+?)"/i',
+ $contents, $matches);
+ $summary=$matches[1];
+
+ /* Extract the title from the webpage contents */
+ preg_match('/<meta name="title" content="(.+?)"/i',
+ $contents, $matches);
+ $title=$matches[1];
+
+ /* Extract the thumbnail URL from the webpage contents */
+ preg_match('/"videothumbnail" href="(.+?)"/i',
+ $contents, $matches);
+ $thumbnail=$matches[1];
+
+ /* Determine what our width and height should be based on our useRemoteSize parameter */
+ if(!strcmp($useRemoteSize,"true")) {
+ preg_match('/id="vimeo_player_'.$video_id.'".+?style="width:(\d+)px;height:(\d+)px;"/i',
+ $contents, $matches);
+ $width = $matches[1];
+ $height = $matches[2];
+ }
+
+ /* Determine if the video should autoplay or not based on the autoStart parameter */
+ $autoStartStr="";
+ if(!strcmp($autoStart,"true")) {
+ $autoStartStr="&autoplay=1";
+ }
+
+ /* Format the description to hold a reference to the embedded video */
+ $description = '<object type="application/x-shockwave-flash" width="'.$width.'" height="'.$height.'"';
+ $description.= 'data="http://www.vimeo.com/moogaloop.swf?clip_id='.$video_id;
+ $description.= '&server=www.vimeo.com&fullscreen=1&show_title=1'.$autoStartStr;
+ $description.= '&show_byline=1&show_portrait=0&color=">';
+ $description.= '<param name="quality" value="best" />';
+ $description.= '<param name="allowfullscreen" value="true" />';
+ $description.= '<param name="scale" value="showAll" />';
+ $description.= '<param name="movie" value="http://www.vimeo.com/moogaloop.swf?clip_id='.$video_id;
+ $description.= '&server=www.vimeo.com&fullscreen=1&show_title=1'.$autoStartStr;
+ $description.= '&show_byline=1&show_portrait=0&color=" />';
+ $description.= '</object>';
+
/*
**********************************
* Embed a remote .swf file