Exemple #1
0
if (!is_array($imgInfo)) {
    //show the default image, otherwise we quit!
    $default = $manager->getDefaultThumb();
    if ($default) {
        header('Location: ' . $default);
        exit;
    }
}
//if the image is less than the thumbnail dimensions
//send the original image as thumbnail
if ($imgInfo[0] <= $IMConfig['thumbnail_width'] && $imgInfo[1] <= $IMConfig['thumbnail_height']) {
    header('Location: ' . $manager->getFileURL($image));
    exit;
}
//Check for thumbnails
$thumbnail = $manager->getThumbName($fullpath);
if (is_file($thumbnail)) {
    //if the thumbnail is newer, send it
    if (filemtime($thumbnail) >= filemtime($fullpath)) {
        header('Location: ' . $manager->getThumbURL($image));
        exit;
    }
}
//creating thumbnails
$thumbnailer = new Thumbnail($IMConfig['thumbnail_width'], $IMConfig['thumbnail_height']);
$thumbnailer->createThumbnail($fullpath, $thumbnail);
//Check for NEW thumbnails
if (is_file($thumbnail)) {
    //send the new thumbnail
    header('Location: ' . $manager->getThumbURL($image));
    exit;