Added some new images. Fixed google video description matching.
[embedvideo/.git] / ItemAddEmbedVideo.inc
index f7ab0132964224ab232c984a6c6abc1ddc9325ba..3a1fa7967e7cda4195a2e7fb54057d346917c8a5 100644 (file)
@@ -257,7 +257,8 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
               }
 
               /* Extract the summary from the webpage contents */
-              preg_match('/<meta content="(.+?)\. \w+ \d+, \d+.*" name="description">/i',
+              //print "contents: $contents <br>";
+              preg_match('/<meta name="description" content="(.+?)\. \w+ \d+, \d+.*">/i',
                          $contents, $matches);
               $summary=$matches[1];
 
@@ -618,15 +619,18 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
                       }
                   }
                   
-                  // Obtainin the width and height of the original thumbnail, finding out it's ratio,
+                  // Obtain the width and height of the original thumbnail, finding out it's ratio,
                   // and using that ratio when determining the width of the video below.
                   // Example: youtube: 130x97 google: 160x120 metacafe: 90x76 yahoo: 100x70
                   // Set the thumbnailHeight to the current thumbnailSize
                   // Set the thumbnailWidth to the appropriate size based on the thumbnailHeight * ratio
                   $image_data = @getimagesize($tmpFile);
+                  if(!$image_data) {
+                    return array(GalleryCoreApi::error(ERROR_STORAGE_FAILURE,__FILE__,__LINE__,
+                           "Unable to retrieve thumbnail dimensions for: $tmpFile"),null,null);
+                  }
                   $ratio = $image_data[0] / $image_data[1];
                   $debugString.="Using ratio from original thumbnail of $ratio. ";
-                  $thumbnailSize=150;
                   $thumbnailHeight=$thumbnailSize;
                   $thumbnailWidth=round($thumbnailHeight * $ratio);
                   $debugString.="Resizing thumbnail image to $thumbnailWidth x $thumbnailHeight: $tmpFile -> $newTmpFile <br>";