From: Alan Jack Pippin Date: Mon, 2 Jul 2007 05:05:35 +0000 (-0600) Subject: Added debug messages around rescaling the thumbnail X-Git-Tag: 1_0_4~3 X-Git-Url: http://git.pippins.net/embedvideo/.git/%22%22.%24thumbnail.%22/%7Bdone_action%7D?a=commitdiff_plain;h=5a178a5689d8a62fbb9e5da64869cc4b9d32070f;p=embedvideo%2F.git Added debug messages around rescaling the thumbnail --- diff --git a/ItemAddEmbedVideo.inc b/ItemAddEmbedVideo.inc index 6d1e8d7..4603709 100644 --- a/ItemAddEmbedVideo.inc +++ b/ItemAddEmbedVideo.inc @@ -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
"; - } - 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.
"; + 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
"; + break; + } + } } - } - } - if(!strcmp($debugOutput,"true")) { - print "Resizing thumbnail image to $thumbnailSize: $tmpFile -> $newTmpFile
"; + $debugString.="Resizing thumbnail image to $thumbnailSize: $tmpFile -> $newTmpFile
"; + $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 */ diff --git a/module.inc b/module.inc index 9ca5ffb..20cbd5a 100644 --- a/module.inc +++ b/module.inc @@ -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));