コード例 #1
0
                 $CacheImage = CacheImage::GetCacheImages(new CacheImageSearchParameters(FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, FALSE, $ImageID, FALSE, FALSE, FALSE, $Width, $Height));
                 if ($CacheImage) {
                     $CacheImage = $CacheImage[0];
                     Image::OutputImage($CacheImage->getFilenameOnDisk(), $CacheImage->getImageWidth(), $CacheImage->getImageHeight(), TRUE);
                 } else {
                     $Image = Image::GetImages(new ImageSearchParameters($ImageID));
                     if ($Image) {
                         $Image = $Image[0];
                         $Set = $Image->getSet();
                         $Model = $Set->getModel();
                         if (file_exists($Image->getFilenameOnDisk())) {
                             $CacheImage = new CacheImage();
                             $CacheImage->setImageID($ImageID);
                             $CacheImage->setKind(CACHEIMAGE_KIND_IMAGE);
                             $CacheImage->setImageWidth($Width);
                             $CacheImage->setImageHeight($Height);
                             CacheImage::Insert($CacheImage, $CurrentUser);
                             Image::OutputImage($Image->getFilenameOnDisk(), $Width, $Height, TRUE, $CacheImage->getFilenameOnDisk());
                         } else {
                             Image::OutputImage();
                         }
                     } else {
                         Image::OutputImage();
                     }
                 }
             } else {
                 HTMLstuff::RefererRedirect();
             }
         }
     }
 }
コード例 #2
0
}
$pageIterator = 1;
$perPage = $perPage && $perPage > 0 ? $perPage : count($Sets);
$uuid = Utils::UUID();
$cacheImages = array();
while (($pageIterator - 1) * $perPage < count($Sets)) {
    $Sets2Process = array_slice($Sets, ($pageIterator - 1) * $perPage, $perPage);
    $img = GenerateModelIndex($Sets2Process, $Images, $finalWidth, $finalHeight);
    if (is_null($img)) {
        $img = imagecreatefromjpeg($pathPrefix . 'images/missing.jpg');
    }
    $CacheImage = new CacheImage($uuid);
    $CacheImage->setModelIndexID($ModelID);
    $CacheImage->setKind(CACHEIMAGE_KIND_INDEX);
    $CacheImage->setImageWidth($finalWidth);
    $CacheImage->setImageHeight($finalHeight);
    $CacheImage->setSequenceNumber($pageIterator);
    $CacheImage->setSequenceTotal(ceil(count($Sets) / $perPage));
    CacheImage::Insert($CacheImage, $CurrentUser);
    imagejpeg($img, $CacheImage->getFilenameOnDisk());
    imagedestroy($img);
    $cacheImages[] = $CacheImage;
    $pageIterator++;
}
if ($outputMode == EXPORT_OPTION_IMAGE && count($cacheImages) == 1) {
    $CacheImage = $cacheImages[0];
    Image::OutputImage($CacheImage->getFilenameOnDisk(), $CacheImage->getImageWidth(), $CacheImage->getImageHeight(), TRUE, NULL, $PromptDownload ? sprintf('%1$s.jpg', $Model->GetFullName()) : NULL);
}
if ($outputMode == EXPORT_OPTION_ZIP && count($cacheImages) > 0) {
    $tmpFile = sprintf('%1$s/%2$s.zip', sys_get_temp_dir(), Utils::UUID());
    $finalFile = sprintf('Index %1$s.zip', $Model->GetFullName());