Skip to content

Commit 4ab5e08

Browse files
Merge pull request #199 from activated-insights/explicit-float-cast
More Float to Int Casting
2 parents 1f1c0c7 + 042aecb commit 4ab5e08

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

lib/ImageResize.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public function save($filename, $image_type = null, $quality = null, $permission
226226
if( !empty($exact_size) && is_array($exact_size) ){
227227
$dest_image = imagecreatetruecolor($exact_size[0], $exact_size[1]);
228228
} else{
229-
$dest_image = imagecreatetruecolor($this->getDestWidth(), $this->getDestHeight());
229+
$dest_image = imagecreatetruecolor((int) $this->getDestWidth(), (int) $this->getDestHeight());
230230
}
231231

232232
$background = imagecolorallocatealpha($dest_image, 255, 255, 255, 1);
@@ -253,9 +253,9 @@ public function save($filename, $image_type = null, $quality = null, $permission
253253
$background = imagecolorallocate($dest_image, 255, 255, 255);
254254
imagefilledrectangle($dest_image, 0, 0, $exact_size[0], $exact_size[1], $background);
255255
} else{
256-
$dest_image = imagecreatetruecolor($this->getDestWidth(), $this->getDestHeight());
256+
$dest_image = imagecreatetruecolor((int) $this->getDestWidth(), (int) $this->getDestHeight());
257257
$background = imagecolorallocate($dest_image, 255, 255, 255);
258-
imagefilledrectangle($dest_image, 0, 0, $this->getDestWidth(), $this->getDestHeight(), $background);
258+
imagefilledrectangle($dest_image, 0, 0, (int) $this->getDestWidth(), (int) $this->getDestHeight(), $background);
259259
}
260260

261261
imagealphablending($dest_image, false);
@@ -269,9 +269,9 @@ public function save($filename, $image_type = null, $quality = null, $permission
269269
$background = imagecolorallocate($dest_image, 255, 255, 255);
270270
imagefilledrectangle($dest_image, 0, 0, $exact_size[0], $exact_size[1], $background);
271271
} else{
272-
$dest_image = imagecreatetruecolor($this->getDestWidth(), $this->getDestHeight());
272+
$dest_image = imagecreatetruecolor((int) $this->getDestWidth(), (int) $this->getDestHeight());
273273
$background = imagecolorallocate($dest_image, 255, 255, 255);
274-
imagefilledrectangle($dest_image, 0, 0, $this->getDestWidth(), $this->getDestHeight(), $background);
274+
imagefilledrectangle($dest_image, 0, 0, (int) $this->getDestWidth(), (int) $this->getDestHeight(), $background);
275275
}
276276

277277
imagealphablending($dest_image, false);
@@ -284,13 +284,13 @@ public function save($filename, $image_type = null, $quality = null, $permission
284284
if( !empty($exact_size) && is_array($exact_size) ){
285285
$dest_image = imagecreate($exact_size[0], $exact_size[1]);
286286
} else{
287-
$dest_image = imagecreate($this->getDestWidth(), $this->getDestHeight());
287+
$dest_image = imagecreate((int) $this->getDestWidth(), (int) $this->getDestHeight());
288288
}
289289
} else {
290290
if( !empty($exact_size) && is_array($exact_size) ){
291291
$dest_image = imagecreatetruecolor($exact_size[0], $exact_size[1]);
292292
} else{
293-
$dest_image = imagecreatetruecolor($this->getDestWidth(), $this->getDestHeight());
293+
$dest_image = imagecreatetruecolor((int) $this->getDestWidth(), (int) $this->getDestHeight());
294294
}
295295
}
296296

@@ -308,9 +308,9 @@ public function save($filename, $image_type = null, $quality = null, $permission
308308
$background = imagecolorallocate($dest_image, 255, 255, 255);
309309
imagefilledrectangle($dest_image, 0, 0, $exact_size[0], $exact_size[1], $background);
310310
} else {
311-
$dest_image = imagecreatetruecolor($this->getDestWidth(), $this->getDestHeight());
311+
$dest_image = imagecreatetruecolor((int) $this->getDestWidth(), (int) $this->getDestHeight());
312312
$background = imagecolorallocate($dest_image, 255, 255, 255);
313-
imagefilledrectangle($dest_image, 0, 0, $this->getDestWidth(), $this->getDestHeight(), $background);
313+
imagefilledrectangle($dest_image, 0, 0, (int) $this->getDestWidth(), (int) $this->getDestHeight(), $background);
314314
}
315315
break;
316316
}

0 commit comments

Comments
 (0)