<?php include_once './include/thumb.php'; $mythumb = new thumb(); $mythumb->loadImage('uploads/book82.jpg'); //$mythumb->resize(100, 'width'); $mythumb->crop(200, 150, "top"); $mythumb->save("test.jpg"); $mythumb->show();
function create_image($source, $route, $new_w) { require_once 'thumbnails.php'; $image = new thumb(); $image->loadImage($source); $image->resize($new_w, 'width'); $image->save($route, 100); }
function pruebaresize($url, $filename, $w, $h, $sel_width, $sel_height, $sel_x, $sel_y) { $len = strlen($filename); $pos = strripos($filename, "."); $ext = strtolower(substr($filename, ($len - $pos - 1) * -1)); $base = substr($filename, 0, $pos); $newImage = $base . "-" . $w . "x" . $h . "." . $ext; $mythumb = new thumb(); $mythumb->loadImage($url . $filename); $mythumb->crop($sel_width, $sel_height, $sel_x, $sel_y); $mythumb->save($url . $newImage); $mythumb = new thumb(); $mythumb->loadImage($url . $newImage); $mythumb->resize($h, 'height'); $mythumb->save($url . $newImage); }
<?php header('Content-Type: image/jpg'); include_once 'thumb.php'; $nombreImg = isset($_GET["img"]) ? $_GET["img"] : "avatarimg"; $resolution = isset($_GET["size"]) ? $_GET["size"] : "100-w"; if ($resolution == '') { $resolution = "100-w"; } if ($nombreImg == '') { $nombreImg = "avatarimg.jpg"; } $widthheight = array("w" => "width", "h" => "height"); list($pixeles, $orientacion) = explode("-", $resolution); $mythumb = new thumb(); $mythumb->loadImage("../../img/" . $nombreImg); $mythumb->resize($pixeles, $widthheight[$orientacion]); $mythumb->show();