Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit d31aa80

Browse files
Explicitly cast floats to integers
1 parent d288347 commit d31aa80

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

‎lib/ImageResize.php

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -241,9 +241,9 @@ public function save($filename, $image_type = null, $quality = null, $permission
241241
$background = imagecolorallocate($dest_image, 255, 255, 255);
242242
imagefilledrectangle($dest_image, 0, 0, $exact_size[0], $exact_size[1], $background);
243243
} else{
244-
$dest_image = imagecreatetruecolor($this->getDestWidth(), $this->getDestHeight());
244+
$dest_image = imagecreatetruecolor((int) $this->getDestWidth(), (int) $this->getDestHeight());
245245
$background = imagecolorallocate($dest_image, 255, 255, 255);
246-
imagefilledrectangle($dest_image, 0, 0, $this->getDestWidth(), $this->getDestHeight(), $background);
246+
imagefilledrectangle($dest_image, 0, 0, (int) $this->getDestWidth(), (int) $this->getDestHeight(), $background);
247247
}
248248
break;
249249

@@ -337,12 +337,12 @@ public function save($filename, $image_type = null, $quality = null, $permission
337337
$this->source_image,
338338
$this->dest_x,
339339
$this->dest_y,
340-
$this->source_x,
341-
$this->source_y,
342-
$this->getDestWidth(),
343-
$this->getDestHeight(),
344-
$this->source_w,
345-
$this->source_h
340+
(int) $this->source_x,
341+
(int) $this->source_y,
342+
(int) $this->getDestWidth(),
343+
(int) $this->getDestHeight(),
344+
(int) $this->source_w,
345+
(int) $this->source_h
346346
);
347347

348348
if ($this->gamma_correct) {
@@ -712,7 +712,7 @@ public function getSourceHeight()
712712
/**
713713
* Gets width of the destination image
714714
*
715-
* @return integer
715+
* @return integer|float
716716
*/
717717
public function getDestWidth()
718718
{
@@ -721,7 +721,8 @@ public function getDestWidth()
721721

722722
/**
723723
* Gets height of the destination image
724-
* @return integer
724+
*
725+
* @return integer|float
725726
*/
726727
public function getDestHeight()
727728
{

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /