Add v0.0.3

This commit is contained in:
Sébastien Lucas 2012-05-28 07:06:12 +02:00
parent f460bd8731
commit 2308af6033
10 changed files with 146 additions and 24 deletions

View file

@ -10,6 +10,10 @@
require_once ("book.php");
global $config;
$expires = 60*60*24*14;
header("Pragma: public");
header("Cache-Control: maxage=".$expires);
header('Expires: ' . gmdate('D, d M Y H:i:s', time()+$expires) . ' GMT');
$bookId = $_GET["id"];
$book = Book::getBookById($bookId);
$type = getURLParam ("type", "jpg");
@ -43,6 +47,31 @@
imagedestroy($dst_img);
return;
}
if (isset($_GET["height"]))
{
$file = $book->getFilePath ($type);
// get image size
if($size = GetImageSize($file)){
$w = $size[0];
$h = $size[1];
//set new size
$nh = $_GET["height"];
$nw = ($nh*$w)/$h;
}
else{
//set new size
$nw = "160";
$nh = "120";
}
//draw the image
$src_img = imagecreatefromjpeg($file);
$dst_img = imagecreatetruecolor($nw,$nh);
imagecopyresampled($dst_img, $src_img, 0, 0, 0, 0, $nw, $nh, $w, $h);//resizing the image
imagejpeg($dst_img,"",100);
imagedestroy($src_img);
imagedestroy($dst_img);
return;
}
break;
default:
header("Content-type: " . Book::$mimetypes[$type]);