Back to PhocacartFileThumbnail class

Method getThumbnailName

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

Method getThumbnailName - Source code

/*
 *Get thumbnailname
 */
public static function getThumbnailName($filename, $size, $manager)
{
    $path = PhocacartPath::getPath($manager);
    $title = PhocacartFile::getTitleFromFilenameWithExt($filename);
    $paramsC = PhocacartUtils::getComponentParameters();
    $thumb_name_prefix = $paramsC->get('thumb_name_prefix', 'phoca_thumb');
    $thumbName = new CMSObject();
    switch ($size) {
        case 'large':
            $fileNameThumb = $thumb_name_prefix . '_l_' . $title;
            $thumbName->abs = Path::clean(str_replace($title, 'thumbs/' . $fileNameThumb, $path['orig_abs_ds'] . $filename));
            $thumbName->rel = str_replace($title, 'thumbs/' . $fileNameThumb, $path['orig_rel_ds'] . $filename);
            break;
        case 'medium':
            $fileNameThumb = $thumb_name_prefix . '_m_' . $title;
            $thumbName->abs = Path::clean(str_replace($title, 'thumbs/' . $fileNameThumb, $path['orig_abs_ds'] . $filename));
            $thumbName->rel = str_replace($title, 'thumbs/' . $fileNameThumb, $path['orig_rel_ds'] . $filename);
            break;
        default:
        case 'small':
            $fileNameThumb = $thumb_name_prefix . '_s_' . $title;
            $thumbName->abs = Path::clean(str_replace($title, 'thumbs/' . $fileNameThumb, $path['orig_abs_ds'] . $filename));
            $thumbName->rel = str_replace($title, 'thumbs/' . $fileNameThumb, $path['orig_rel_ds'] . $filename);
            break;
    }
    $thumbName->rel = str_replace('//', '/', $thumbName->rel);
    return $thumbName;
}