Minor refactoring. re #127

This commit is contained in:
Sébastien Lucas 2013-12-15 14:25:57 +01:00
parent 27c7743995
commit 30ae05c595
1 changed files with 6 additions and 5 deletions

View File

@ -444,6 +444,11 @@ class Book extends Base {
if (is_null ($width) && is_null ($height)) {
return false;
}
// In case something bad happen below set a default size
$nw = "160";
$nh = "120";
$file = $this->getFilePath ("jpg");
// get image size
if ($size = GetImageSize($file)) {
@ -460,11 +465,7 @@ class Book extends Base {
$nw = ($nh*$w)/$h;
}
}
else{
//set new size
$nw = "160";
$nh = "120";
}
//draw the image
$src_img = imagecreatefromjpeg($file);
$dst_img = imagecreatetruecolor($nw,$nh);