Back to PhocaGalleryImageFront class

Method displayCategoriesExtImgOrFolder

public static
displayCategoriesExtImgOrFolder
(mixed $exts, mixed $extm, mixed $extw, mixed $exth, mixed $imgCategoriesSize, mixed $rightDisplayKey = 0)

Method displayCategoriesExtImgOrFolder - Source code

/*
 * IMAGE OR FOLDER - CATEGORIES VIEW - EXTERNAL IMAGE
 * 0-small,1-medium,2-smallFolder,3-mediumFolder,4-smallShadow,5-mediumShadow,6-smallFolderShadow,7-mediumFolderShadow
 */
public static function displayCategoriesExtImgOrFolder($exts, $extm, $extw, $exth, $imgCategoriesSize, $rightDisplayKey = 0)
{
    phocagalleryimport('phocagallery.image.image');
    phocagalleryimport('phocagallery.path.path');
    phocagalleryimport('phocagallery.file.filethumbnail');
    $path = PhocaGalleryPath::getPath();
    $fileThumbnail = new CMSObject();
    $fileThumbnail->rel = '';
    $fileThumbnail->extw = '';
    $fileThumbnail->exth = '';
    $fileThumbnail->extpic = false;
    $extw = explode(',', $extw);
    $exth = explode(',', $exth);
    $paramsC = ComponentHelper::getParams('com_phocagallery');
    if (!isset($extw[0])) {
        $extw[0] = $paramsC->get('large_image_width', 640);
    }
    if (!isset($extw[1])) {
        $extw[1] = $paramsC->get('medium_image_width', 256);
    }
    if (!isset($extw[2])) {
        $extw[2] = $paramsC->get('small_image_width', 128);
    }
    if (!isset($exth[0])) {
        $exth[0] = $paramsC->get('large_image_height', 480);
    }
    if (!isset($exth[1])) {
        $exth[1] = $paramsC->get('medium_image_height', 192);
    }
    if (!isset($exth[2])) {
        $exth[2] = $paramsC->get('small_image_height', 96);
    }
    // if category is not accessable, display the key in the image:
    $key = '';
    if ((int) $rightDisplayKey == 0) {
        $key = '-key';
        return false;
    }
    switch ($imgCategoriesSize) {
        // user wants to display only icon folder (parameters) medium
        case 3:
        case 7:
            return false;
            //$fileThumbnail->rel	= $path->image_rel_front . 'icon-folder-medium'.$key.'.png';
            break;
        // user wants to display only icon folder (parameters) small
        case 2:
        case 6:
            return false;
            //$fileThumbnail->rel	= $path->image_rel_front . 'icon-folder-small-main'.$key.'.png';
            break;
        // standard medium image next to category in categories view - if the file doesn't exist, it will be displayed folder icon
        case 1:
        case 5:
            if ($extm == '' || (int) $rightDisplayKey == 0) {
                return false;
                //$fileThumbnail->rel		= $path->image_rel_front . 'icon-folder-medium'.$key.'.png';
            } else {
                $fileThumbnail->rel = $extm;
                $fileThumbnail->extw = $extw[1];
                $fileThumbnail->exth = $exth[1];
                $fileThumbnail->extpic = true;
            }
            break;
        // standard small image next to category in categories view - if the file doesn't exist, it will be displayed folder icon
        case 0:
        case 4:
            if ($exts == '' || (int) $rightDisplayKey == 0) {
                return false;
                //$fileThumbnail->rel		= $path->image_rel_front . 'icon-folder-small-main'.$key.'.png';
            } else {
                $fileThumbnail->rel = $exts;
                $fileThumbnail->extw = $extw[2];
                $fileThumbnail->exth = $exth[2];
                $fileThumbnail->extpic = true;
            }
            break;
    }
    return $fileThumbnail;
}