PHPFusion\Downloads\Functions::get_download_image_path PHP Метод

get_download_image_path() публичный статический Метод

Get the best available paths for image and thumbnail
public static get_download_image_path ( $download_image, $download_image_thumb, boolean | FALSE $hiRes = false ) : boolean | string
$download_image
$download_image_thumb
$hiRes boolean | FALSE
Результат boolean | string
    public static function get_download_image_path($download_image, $download_image_thumb, $hiRes = false)
    {
        if (!$hiRes) {
            if ($download_image_thumb && file_exists(DOWNLOADS . 'images/thumbs/' . $download_image_thumb)) {
                return DOWNLOADS . 'images/thumbs/' . $download_image_thumb;
            }
            if ($download_image_thumb && file_exists(DOWNLOADS . 'images/thumbs/' . $download_image_thumb)) {
                return DOWNLOADS . 'images/thumbs/' . $download_image_thumb;
            }
            if ($download_image && file_exists(DOWNLOADS . 'images/' . $download_image)) {
                return DOWNLOADS . 'images/' . $download_image;
            }
        } else {
            if ($download_image && file_exists(DOWNLOADS . 'images/' . $download_image)) {
                return DOWNLOADS . 'images/' . $download_image;
            }
            if ($download_image_thumb && file_exists(DOWNLOADS . 'images/' . $download_image_thumb)) {
                return DOWNLOADS . 'images/' . $download_image_thumb;
            }
            if ($download_image_thumb && file_exists(DOWNLOADS . 'images/thumbs/' . $download_image_thumb)) {
                return DOWNLOADS . 'images/thumbs/' . $download_image_thumb;
            }
        }
        return false;
    }

Usage Example

Пример #1
0
/**
 * Get the closest image available
 * @param      $image
 * @param      $thumb1
 * @param bool $hires - true for image, false for thumbnail
 * @return bool|string
 */
function get_download_image_path($image, $thumb1, $hires = FALSE)
{
    return \PHPFusion\Downloads\Functions::get_download_image_path($image, $thumb1, $hires);
}