Back to PhocaGalleryFileThumbnail class

Method getThumbnailName

public static
getThumbnailName
(mixed $filename, mixed $size)

Method getThumbnailName - Source code

/*
 *Get thumbnailname
 */
public static function getThumbnailName($filename, $size)
{
    $path = PhocaGalleryPath::getPath();
    $title = PhocaGalleryFile::getTitleFromFile($filename, 1);
    $thumbName = new CMSObject();
    switch ($size) {
        case 'large':
            $fileNameThumb = 'phoca_thumb_l_' . $title;
            $thumbName->abs = Path::clean(str_replace($title, 'thumbs' . '/' . $fileNameThumb, $path->image_abs . $filename));
            $thumbName->rel = str_replace($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
            break;
        case 'large1':
            $fileNameThumb = 'phoca_thumb_l1_' . $title;
            $thumbName->abs = Path::clean(str_replace($title, 'thumbs' . '/' . $fileNameThumb, $path->image_abs . $filename));
            $thumbName->rel = str_replace($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
            break;
        case 'medium1':
            $fileNameThumb = 'phoca_thumb_m1_' . $title;
            $thumbName->abs = Path::clean(str_replace($title, 'thumbs' . '/' . $fileNameThumb, $path->image_abs . $filename));
            $thumbName->rel = str_replace($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
            break;
        case 'medium2':
            $fileNameThumb = 'phoca_thumb_m2_' . $title;
            $thumbName->abs = Path::clean(str_replace($title, 'thumbs' . '/' . $fileNameThumb, $path->image_abs . $filename));
            $thumbName->rel = str_replace($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
            break;
        case 'medium3':
            $fileNameThumb = 'phoca_thumb_m3_' . $title;
            $thumbName->abs = Path::clean(str_replace($title, 'thumbs' . '/' . $fileNameThumb, $path->image_abs . $filename));
            $thumbName->rel = str_replace($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
            break;
        case 'medium':
            $fileNameThumb = 'phoca_thumb_m_' . $title;
            $thumbName->abs = Path::clean(str_replace($title, 'thumbs' . '/' . $fileNameThumb, $path->image_abs . $filename));
            $thumbName->rel = str_replace($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
            break;
        case 'small1':
            $fileNameThumb = 'phoca_thumb_s1_' . $title;
            $thumbName->abs = Path::clean(str_replace($title, 'thumbs' . '/' . $fileNameThumb, $path->image_abs . $filename));
            $thumbName->rel = str_replace($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
            break;
        case 'small2':
            $fileNameThumb = 'phoca_thumb_s2_' . $title;
            $thumbName->abs = Path::clean(str_replace($title, 'thumbs' . '/' . $fileNameThumb, $path->image_abs . $filename));
            $thumbName->rel = str_replace($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
            break;
        case 'small3':
            $fileNameThumb = 'phoca_thumb_s3_' . $title;
            $thumbName->abs = Path::clean(str_replace($title, 'thumbs' . '/' . $fileNameThumb, $path->image_abs . $filename));
            $thumbName->rel = str_replace($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
            break;
        default:
        case 'small':
            $fileNameThumb = 'phoca_thumb_s_' . $title;
            $thumbName->abs = Path::clean(str_replace($title, 'thumbs' . '/' . $fileNameThumb, $path->image_abs . $filename));
            $thumbName->rel = str_replace($title, 'thumbs/' . $fileNameThumb, $path->image_rel . $filename);
            break;
    }
    $thumbName->rel = str_replace('//', '/', $thumbName->rel);
    return $thumbName;
}