Minor refactoring. re #127
This commit is contained in:
parent
27c7743995
commit
30ae05c595
11
book.php
11
book.php
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue