Added debug messages around rescaling the thumbnail
authorAlan Jack Pippin <ajp@pippin.(none)>
Mon, 2 Jul 2007 05:05:35 +0000 (23:05 -0600)
committerAlan J. Pippin <ajp@pippins.net>
Mon, 2 Jul 2007 05:05:35 +0000 (23:05 -0600)
ItemAddEmbedVideo.inc
module.inc

index 6d1e8d7c5f26f945d6d670856bbf2c38ce1b762e..460370918a7e19a75e97f642ab05850cc129c3d4 100644 (file)
@@ -521,31 +521,33 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
           }
 
           /* Resize the thumbnail image to the size indicated by our album */
+          $debugString="";
           list ($ret, $toolkit) = GalleryCoreApi::getToolkitByOperation($mimeType, 'resize');
           if (!$ret) {
-            if(!strcmp($debugOutput,"true")) {
-              print "Checking to see if toolkit was found <br>";
-            }
-            if (isset($toolkit)) {
-              $newTmpFile = $platform->tempnam($tmpDir, 'add');
-              $newTmpFile.= ".jpg";
-              $thumbnailSize = 150;
-              list ($ret, $preferences) = GalleryCoreApi::fetchDerivativePreferencesForItem($item->getId());
-              if(!$ret) {
-                foreach ($preferences as $preference) {
-                  if (preg_match('/thumbnail\|(\d+)/',
-                                 $preference['derivativeOperations'], $matches)) {
-                    $thumbnailSize = $matches[1];
-                    break;
+              $debugString.="Checking to see if a toolkit that can resize images was found. <br>";
+              if (isset($toolkit)) {
+                  $newTmpFile = $platform->tempnam($tmpDir, 'add');
+                  $newTmpFile.= ".jpg";
+                  $thumbnailSize = 150;
+                  list ($ret, $preferences) =
+                    GalleryCoreApi::fetchDerivativePreferencesForItem($item->getId());
+                  if(!$ret) {
+                      foreach ($preferences as $preference) {
+                        if (preg_match('/thumbnail\|(\d+)/',
+                                       $preference['derivativeOperations'], $matches)) {
+                            $thumbnailSize = $matches[1];
+                            $debugString.="Found thumbnail size in album preferences: $thumbnailSize <br>";
+                            break;
+                        }
+                      }
                   }
-                }
-              }
-              if(!strcmp($debugOutput,"true")) {
-                print "Resizing thumbnail image to $thumbnailSize: $tmpFile -> $newTmpFile <br>";
+                  $debugString.="Resizing thumbnail image to $thumbnailSize: $tmpFile -> $newTmpFile <br>";
+                  $toolkit->performOperation($mimeType, 'resize', $tmpFile, $newTmpFile,
+                                             array($thumbnailSize,$thumbnailSize));
               }
-              $toolkit->performOperation($mimeType, 'resize', $tmpFile, $newTmpFile,
-                                         array($thumbnailSize,$thumbnailSize));
-            }
+          }
+          if(!strcmp($debugOutput,"true")) {
+              print "$debugString";
           }
           
           /* Make the gallery2 call to add this item to the album */
index 9ca5ffb972139c867ad32cf1135ba9555d27fcd5..20cbd5acd8239bf684db38acd5af8b04fd6b7435 100644 (file)
@@ -33,7 +33,7 @@ class EmbedVideoModule extends GalleryModule {
        $this->setId('embedvideo');
        $this->setName($gallery->i18n('Embed Video'));
        $this->setDescription($gallery->i18n('Add embedded videos from the web'));
-       $this->setVersion('1.0.2');
+       $this->setVersion('1.0.3');
        $this->setGroup('import', $gallery->i18n('Import'));
        $this->setCallbacks('getSiteAdminViews');
        $this->setRequiredCoreApi(array(7, 4));