Minor refactoring. re #127

This commit is contained in:
Sébastien Lucas 2013-12-15 14:25:57 +01:00
parent 27c7743995
commit 30ae05c595

View file

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