Example #1
0
}
$manager = new ExtendedFileManager($IMConfig);
//get the image and the full path to the image
$image = $_GET['img'];
$fullpath = Files::makeFile($manager->getImagesDir(), $image);
//not a file, so exit
if (!is_file($fullpath)) {
    js_fail("File {$fullpath} does not exist.");
}
$imgInfo = @getImageSize($fullpath);
//Not an image, bail out.
if (!is_array($imgInfo)) {
    js_fail("File {$fullpath} is not an image.");
}
if (!isset($_GET['to'])) {
    $resized = $manager->getResizedName($fullpath, $_GET['width'], $_GET['height']);
    $_GET['to'] = $manager->getResizedName($image, $_GET['width'], $_GET['height'], FALSE);
} else {
    $resized = Files::makeFile($manager->getImagesDir(), $_GET['to']);
}
// Check to see if it already exists
if (is_file($resized)) {
    // And is newer
    if (filemtime($resized) >= filemtime($fullpath)) {
        js_success($_GET['to']);
    }
}
// resize (thumbnailer will do this for us just fine)
$thumbnailer = new Thumbnail($_GET['width'], $_GET['height']);
$thumbnailer->proportional = FALSE;
$thumbnailer->createThumbnail($fullpath, $resized);