Closed alphaChris closed 1 year ago
Could you show me how you call the ImageWorkshopLib::generateImage
in your code ?
This is the snippet of my code where we crop the image.
$original_image = DOC_ROOT_MEDIA.$original_image_data['path'].'/'.$original_image_data['image'];
$Filename = $mediaID."_".$original_image_data['image'];
// Saving the result
$createFolders = false;
$backgroundColor = 'transparent'; // transparent, only for PNG (otherwise it will be white if set null)
$imageQuality = 60; // useless for GIF, usefull for PNG and JPEG (0 to 100%)
$layer = ImageWorkshop::initFromPath($original_image);
// Rotate when a degree number is supplied
$degrees = $_POST['crop_rotate'];
$layer->rotate($degrees);
// Crop
$layer->cropInPixel(round($_POST['crop_width']), round($_POST['crop_height']), round($_POST['crop_x']), round($_POST['crop_y']), 'LT');
// Resize
$layer->resizeInPixel(1920, null, true);
$layer->save(DOC_ROOT_MEDIA.$original_image_data['path'].'/', $Filename, $createFolders, $backgroundColor, $imageQuality);
Thanks for the snippet.
Could you also give me values used in the $_POST
variable.
The error message PHP Deprecated: Invalid characters passed for attempted conversion
seems indicate that there is an implicit type cast during the call.
Yes sure. These is an example for the send POST data. The other variables like the $original_image_data will be created by an mysql query.
POST: crop_x: 719.9981695729781 crop_y: 27.63784534538012 crop_width: 175.35937499999997 crop_height: 222.39999999999995 crop_rotate: 1 crop_scaleX: crop_scaleY: mediaID: 154
I confirm the bug.
Just make a fix in #145
Could you try to install the dev-fix-issue-144
version and give me a feedback before merging it ?
Ok sure. I have now installed the version and I dont get any php errors if i crop an image. Thanks
Thanks for your feedback.
Fix has been tagged in 2.2.2 and 3.0.0-beta1.
We've been using PHP 8.1 since the latest and are getting the following deprecated messages.
PHP Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /sybio/image-workshop/src/Core/ImageWorkshopLib.php on line 80 PHP Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /sybio/image-workshop/src/Core/ImageWorkshopLib.php on line 81 PHP Deprecated: Invalid characters passed for attempted conversion, these have been ignored in /sybio/image-workshop/src/Core/ImageWorkshopLib.php on line 82