コード例 #1
0
ファイル: image.php プロジェクト: martinlindhe/core_dev
<?php

// passes thru a image (with optional width & height specified)
namespace cd;

$name = File::getUploadPath($this->owner);
if (!empty($_GET['w']) && !empty($_GET['h'])) {
    $im = new ImageResizer($name);
    if ($_GET['w'] <= $im->getWidth() && $_GET['h'] <= $im->getHeight()) {
        $im->resizeAspect($_GET['w'], $_GET['h']);
    }
} else {
    $im = new Image($name);
}
$im->render();
コード例 #2
0
<?php

namespace cd;

set_include_path(get_include_path() . PATH_SEPARATOR . dirname(__FILE__) . '/../core/');
require_once 'core.php';
require_once 'ImageResizer.php';
$file = '/home/ml/Skrivbord/DSC_1853.JPG';
$x = new ImageResizer($file);
$x->resizeAspect(800, 800);
$x->render('gif', 'resized.gif');
echo "resized to " . $x->getWidth() . "x" . $x->getHeight() . "\n";