Пример #1
0
    public static function GetImagePaths($p_object_type, $p_object_id, $p_check_exists=false, $p_as_url=false)
    {
        global $Campsite;
        
        foreach (BlogImageHelper::GetImageFormats() as $format) {
            $width = $format['width'];
            $height = $format['height'];
            $path[$width.'x'.$height] = $Campsite['IMAGE_DIRECTORY']."plugin_blog/$p_object_type/{$width}x{$height}/image_{$p_object_id}.png";
            
            $url[$width.'x'.$height] = $Campsite['IMAGE_BASE_URL']."plugin_blog/$p_object_type/{$width}x{$height}/image_{$p_object_id}.png";

            if ($p_check_exists && !file_exists($path[$width.'x'.$height])) {
                unset($path[$width.'x'.$height]);
                unset($url[$width.'x'.$height]);
            }
        }

        if ($p_as_url) {
            return (array) $url;    
        } else {
            return (array) $path;
        }
    }