Beispiel #1
0
$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());
    $zip = new ZipArchive();
    if (file_exists($tmpFile)) {