+ /* Resize the thumbnail image to the size indicated by our album */
+ $debugString="";
+ list ($ret, $toolkit) = GalleryCoreApi::getToolkitByOperation($mimeType, 'resize');
+ if (!$ret) {
+ $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;
+ }
+ }
+ }
+ $debugString.="Resizing thumbnail image to $thumbnailSize: $tmpFile -> $newTmpFile <br>";
+ $toolkit->performOperation($mimeType, 'resize', $tmpFile, $newTmpFile,
+ array($thumbnailSize,$thumbnailSize));
+ }
+ }
+ if(!strcmp($debugOutput,"true")) {
+ print "<h2>Thumbnail Resize</h2>";
+ print "$debugString";
+ print "<hr>";
+ }
+