*/ /** * This ItemAddOption allows the user to choose to create thumbnails * when the image is uploaded. * * @package Core * @subpackage UserInterface */ class CreateThumbnailOption extends ItemAddOption { /** * @see ItemAddOption::loadTemplate */ function loadTemplate(&$template, &$form, $item) { return array(GalleryStatus::success(), 'modules/core/templates/CreateThumbnailOption.tpl', 'modules_core'); } /** * @see ItemAddOption::isAppropriate */ function isAppropriate() { return array(GalleryStatus::success(), true); } /** * @see ItemAddOption::handleRequestAfterAdd */ function handleRequestAfterAdd($form, &$item) { $error = array(); $warning = array(); list ($ret, $thumbTable) = GalleryCoreApi::fetchThumbnailsByItemIds(array($item->getId())); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null, null); } if (!empty($thumbTable[$item->getId()])) { $thumbnail = $thumbTable[$item->getId()]; list ($ret, $isCurrent) = $thumbnail->isCacheCurrent(); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null, null); } if (!$isCurrent) { $ret = $thumbnail->rebuildCache(); if ($ret->isError()) { return array($ret->wrap(__FILE__, __LINE__), null, null); } } } return array(GalleryStatus::success(), $error, $warning); } } ?>