Example #1
0
function DefaultImage()
{
    $defaultImg = CACHE_DEFAULT . 'default.jpg';
    // valid image
    if (file_exists($defaultImg)) {
        // read image
        $sendImg = DetectImage($defaultImg, 1);
        $thumb = null;
        $info = array(imagesx($sendImg), imagesy($sendImg), IMAGETYPE_JPEG);
        // cordenates
        $inew_width = isset($_GET['img_w']) ? (int) $_GET['img_w'] : 0;
        $auto_height = isset($_GET['img_h']) ? (int) $_GET['img_h'] : 0;
        $thumb = SmartResizeImage($defaultImg, $inew_width, $auto_height, null, $info, false);
        // check if image was rendenized
        $return = empty($thumb) ? $sendImg : $thumb;
        // send image
        header('Content-type: image/jpg');
        header('Cache-Control: public');
        imagepng($return);
        imagedestroy($return);
        exit(0);
    }
    // return invalid send
    header('HTTP/1.1 400 Bad Request');
    die('Error: no image was specified');
}
Example #2
0
function DefaultImage()
{
    $defaultImg = CACHE_DEFAULT . 'default.png';
    $info = getimagesize($defaultImg);
    $fp = fopen($defaultImg, "rb");
    // valid image
    if ($info && $fp) {
        // read image
        $sendImg = DetectImage($defaultImg);
        $thumb = null;
        // cordenates
        $inew_width = isset($_GET['img_w']) ? (int) $_GET['img_w'] : 0;
        $auto_height = isset($_GET['img_h']) ? (int) $_GET['img_h'] : 0;
        $thumb = SmartResizeImage($defaultImg, $inew_width, $auto_height, null, $info, false);
        // check if image was rendenized
        $return = empty($thumb) ? $sendImg : $thumb;
        // send image
        header('HTTP/1.1 206', true, 206);
        // caution: HTTP status code 206 use for valid default image car, not change this line, about render that image for all clientes and core SDS
        header('Content-type: image/png');
        imagepng($return);
        imagedestroy($return);
        exit;
    }
    // return invalid send
    header('HTTP/1.1 400 Bad Request');
    die('Error: no image was specified');
}