Пример #1
0
    echo 'alert(\'' . $message . '\'); false';
    exit;
}
function js_success($resultFile)
{
    echo '\'' . $resultFile . '\'';
    exit;
}
//check for img parameter in the url
if (!isset($_GET['img']) || !isset($_GET['width']) || !isset($_GET['height'])) {
    js_fail('Missing parameter.');
}
$manager = new ImageManager($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']);
}
Пример #2
0
 * relative to the base_dir given in config.inc.php
 * @author $Author: ray $
 * @version $Id: thumbs.php 761 2007-02-24 02:18:05Z ray $
 * @package ImageManager
 */
require_once 'config.inc.php';
require_once 'Classes/ImageManager.php';
require_once 'Classes/Thumbnail.php';
//check for img parameter in the url
if (!isset($_GET['img'])) {
    exit;
}
$manager = new ImageManager($IMConfig);
//get the image and the full path to the image
$image = rawurldecode($_GET['img']);
$fullpath = Files::makeFile($manager->getImagesDir(), $image);
//not a file, so exit
if (!is_file($fullpath)) {
    exit;
}
$imgInfo = @getImageSize($fullpath);
//Not an image, send default thumbnail
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