Пример #1
0
        if (FileCacheIsLive($src, $ttl)) {
            SendImageFromCache($src);
        }
    }
    if ($validRemote and !CheckRemoteFile($handle)) {
        DefaultImage();
    }
    CreateImageToCache($handle, $thumb_w, $thumb_h, $back, $opt, $src);
} elseif (isset($_GET['i']) and isset($_GET['o'])) {
    // request param, pre sql injection tratament, remove html and limit string code
    $owner = empty($_GET['o']) ? null : substr(addslashes(strip_tags(trim(preg_replace('/\\s/m', '', $_GET['o'])))), 0, 20);
    $image = preg_replace('/\\.[a-z]+$/i', '', $_GET['i']);
    $index = max((int) filter_input(INPUT_GET, 'e', FILTER_SANITIZE_NUMBER_INT), 1);
    // mount file name cache
    $src = CACHE_DIR . sha1(CACHE_DIR . $image . $owner . $index . $thumb_w . $thumb_h . $quality . $opt . ((!empty($_GET['img_bg']) and count(explode(',', $_GET['img_bg'])) == 3) ? $_GET['img_bg'] : '255,255,255')) . $ext;
    // mount url core integration
    $handle = 'https://core.smartdealer.com.br/img/' . $image . '/' . $owner . '/' . $thumb_w . '/' . $index . '.jpg';
    // check if file exists
    if ($cache && file_exists($src)) {
        if (FileCacheIsLive($src, $ttl)) {
            SendImageFromCache($src);
        }
    }
    if ($validRemote and !CheckRemoteFile($handle)) {
        DefaultImage();
    }
    CreateImageToCache($handle, $thumb_w, $thumb_h, $back, $opt, $src);
} else {
    // invalid request, return default image
    DefaultImage();
}
Пример #2
0
    // check if file exists
    if (file_exists($src)) {
        if (FileCacheIsLive($src, $ttl)) {
            SendImageFromCache($src);
        }
    }
    CreateImageToCache($handle, $thumb_w, $thumb_h, $back, $opt, $src);
} elseif (isset($_GET['i']) and isset($_GET['o'])) {
    // request param, pre sql injection tratament, remove html and limit string code
    $owner = empty($_GET['o']) ? null : substr(addslashes(strip_tags(trim(preg_replace('/\\s/m', '', $_GET['o'])))), 0, 20);
    $image = preg_replace('/\\.[a-z]+$/i', '', $_GET['i']);
    $index = substr_count($image, '_') < 2 ? (int) filter_var(!empty($_GET['e']) ? $_GET['e'] : 1, FILTER_SANITIZE_NUMBER_INT) : '';
    $image .= $index ? '_' . $index : '';
    // mount file name cache
    $src = CACHE_DIR . sha1(CACHE_DIR . $image . $owner . $thumb_w . $thumb_h . $quality . $opt . ((!empty($_GET['img_bg']) and count(explode(',', $_GET['img_bg'])) == 3) ? $_GET['img_bg'] : '255,255,255')) . $ext;
    // mount url core integration
    $handle = 'https://core.smartdealer.com.br/img/' . $image . '/' . $owner . '/' . $thumb_w . '/' . $index . '.jpg';
    if (!CheckRemoteFile($handle)) {
        DefaultImage();
    }
    // check if file exists
    if (file_exists($src)) {
        if (FileCacheIsLive($src, $ttl)) {
            SendImageFromCache($src);
        }
    }
    CreateImageToCache($handle, $thumb_w, $thumb_h, $back, $opt, $src);
} else {
    // invalid request, return default image
    DefaultImage();
}