Skip to content

Commit

Permalink
Implicit conversion from float 50.800000000000004 to int loses preci…
Browse files Browse the repository at this point in the history
…sion (#310)
  • Loading branch information
a-d-w-s authored Dec 12, 2022
1 parent 3453dcd commit 82dbef9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/claviska/SimpleImage.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function __construct($image = '', $flags = []) {
$this->flags = [
"sslVerify" => true // Skip SSL peer validation
];

// Override default flag values.
foreach($flags as $flag => $value) {
$this->setFlag($flag, $value);
Expand Down Expand Up @@ -206,7 +206,7 @@ public function fromFile($file) {
$alpha = imagecolorallocatealpha($gif, 0, 0, 0, 127);
imagecolortransparent($gif, $alpha);
imagefill($gif, 0, 0, $alpha);

imagecopy($this->image, $gif, 0, 0, 0, 0, $width, $height);
imagedestroy($gif);
break;
Expand Down Expand Up @@ -526,7 +526,7 @@ protected static function imageCopyMergeAlpha($dstIm, $srcIm, $dstX, $dstY, $src
if($pct < 100) {
// Disable alpha blending and "colorize" the image using a transparent color
imagealphablending($srcIm, false);
imagefilter($srcIm, IMG_FILTER_COLORIZE, 0, 0, 0, 127 * ((100 - $pct) / 100));
imagefilter($srcIm, IMG_FILTER_COLORIZE, 0, 0, 0, round(127 * ((100 - $pct) / 100)));
}

imagecopy($dstIm, $srcIm, (int) $dstX, (int) $dstY, (int) $srcX, (int) $srcY, (int) $srcW, (int) $srcH);
Expand Down

0 comments on commit 82dbef9

Please sign in to comment.