} } else { if ($ImageID) { $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(); }