Implicit conversion from float 50.800000000000004 to int loses precision
a-d-w-s opened this issue · 2 comments
a-d-w-s commented
If I connect two images, I get an error message: notice: Implicit conversion from float 50.800000000000004 to int loses precision.
$imageWatermark = new SimpleImage();
$imageWatermark
->fromFile(WWW_ROOT . 'img' . DS . 'logo-watermark.png')
->resize($image->getWidth() / 5);
$image->overlay($imageWatermark, 'bottom right', .6, -25, -25);
This function does it: $image->overlay(...);
Thank you
a-d-w-s commented
If I modify the code as follows, it no longer returns the error.
protected static function imageCopyMergeAlpha($dstIm, $srcIm, $dstX, $dstY, $srcX, $srcY, $srcW, $srcH, $pct) {
// Are we merging with transparency?
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, round(127 * ((100 - $pct) / 100)));
}
imagecopy($dstIm, $srcIm, (int) $dstX, (int) $dstY, (int) $srcX, (int) $srcY, (int) $srcW, (int) $srcH);
return true;
}
Original line:
imagefilter($srcIm, IMG_FILTER_COLORIZE, 0, 0, 0, 127 * ((100 - $pct) / 100));