PHPFusion\Blog\Functions::get_blog_image_path PHP Метод

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

Get the best available paths for image and thumbnail
public static get_blog_image_path ( $blog_image, $blog_image_t1, $blog_image_t2, boolean $hiRes = FALSE ) : boolean | string
$blog_image
$blog_image_t1
$blog_image_t2
$hiRes boolean -- true for image, false for thumb
Результат boolean | string
    public static function get_blog_image_path($blog_image, $blog_image_t1, $blog_image_t2, $hiRes = FALSE)
    {
        if (!$hiRes) {
            if ($blog_image_t1 && file_exists(IMAGES_B_T . $blog_image_t1)) {
                return IMAGES_B_T . $blog_image_t1;
            }
            if ($blog_image_t1 && file_exists(IMAGES_B . $blog_image_t1)) {
                return IMAGES_B . $blog_image_t1;
            }
            if ($blog_image_t2 && file_exists(IMAGES_B_T . $blog_image_t2)) {
                return IMAGES_B_T . $blog_image_t2;
            }
            if ($blog_image_t2 && file_exists(IMAGES_B . $blog_image_t2)) {
                return IMAGES_B . $blog_image_t2;
            }
            if ($blog_image && file_exists(IMAGES_B . $blog_image)) {
                return IMAGES_B . $blog_image;
            }
        } else {
            if ($blog_image && file_exists(IMAGES_B . $blog_image)) {
                return IMAGES_B . $blog_image;
            }
            if ($blog_image_t2 && file_exists(IMAGES_B . $blog_image_t2)) {
                return IMAGES_B . $blog_image_t2;
            }
            if ($blog_image_t2 && file_exists(IMAGES_B_T . $blog_image_t2)) {
                return IMAGES_B_T . $blog_image_t2;
            }
            if ($blog_image_t1 && file_exists(IMAGES_B . $blog_image_t1)) {
                return IMAGES_B . $blog_image_t1;
            }
            if ($blog_image_t1 && file_exists(IMAGES_B_T . $blog_image_t1)) {
                return IMAGES_B_T . $blog_image_t1;
            }
        }
        return FALSE;
    }

Usage Example

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