X-Git-Url: http://git.pippins.net/embedvideo/.git/%27%20%20%20%20.%20%24GLOBALS%5B%27phpgw%27%5D-%3Elink%28%27inc/jquery/jquery.tablesorter.css%27%29.%27?a=blobdiff_plain;f=ItemAddEmbedVideo.inc;h=6d1e8d7c5f26f945d6d670856bbf2c38ce1b762e;hb=2266d371cd774ad41e57be7520b3121486437615;hp=28d4a809bee049b1e6a63813bc8aa235a9aed917;hpb=b1952ee04d2ae62ede96d5c61ab096cd237c1c3b;p=embedvideo%2F.git
diff --git a/ItemAddEmbedVideo.inc b/ItemAddEmbedVideo.inc
index 28d4a80..6d1e8d7 100644
--- a/ItemAddEmbedVideo.inc
+++ b/ItemAddEmbedVideo.inc
@@ -18,6 +18,9 @@
* Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA.
*/
+GalleryCoreApi::requireOnce('modules/gd/classes/GdToolkitHelper.class');
+
+
/**
* This plugin will handle the addition of embedded video objects
* @package embedVideo
@@ -517,8 +520,36 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
print "
Video Successfully Added to your Gallery Album
";
}
+ /* Resize the thumbnail image to the size indicated by our album */
+ 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;
+ }
+ }
+ }
+ if(!strcmp($debugOutput,"true")) {
+ print "Resizing thumbnail image to $thumbnailSize: $tmpFile -> $newTmpFile
";
+ }
+ $toolkit->performOperation($mimeType, 'resize', $tmpFile, $newTmpFile,
+ array($thumbnailSize,$thumbnailSize));
+ }
+ }
+
/* Make the gallery2 call to add this item to the album */
- list ($ret, $newItem) = GalleryCoreApi::addItemToAlbum($tmpFile,
+ list ($ret, $newItem) = GalleryCoreApi::addItemToAlbum($newTmpFile,
$fileName,
$title,
$summary,
@@ -534,7 +565,13 @@ class ItemAddEmbedVideo extends ItemAddPlugin {
'id' => $newItem->getId(),
'warnings' => array());
}
- @$platform->unlink($tmpFile);
+
+ /* Keep the tmpfiles around if we are in debug mode. Otherwise, remove them. */
+ if(!strcmp($debugOutput,"false")) {
+ @$platform->unlink($tmpFile);
+ @$platform->unlink($newTmpFile);
+ }
+
}
return array(null, $error, $status);