- Issue created by @gloomcheng
If there is custom code you must provide it in a bug report so that the community can reproduce the bug.
- πΉπΌTaiwan gloomcheng
I just run the resize functional provieded from Batch Image Resize module without any custom code.
I do some modify to confirm that this issue is most related core instead of Batch Image Resize, and can confirm the module can work on PHP 7.4 environment. - Status changed to Postponed: needs info
almost 2 years ago 3:25am 1 February 2023 Please explain in some detail why this is a Drupal core bug based on your research.
Add to the issue summary steps to reproduce the bug that contributors can follow.
- πΉπΌTaiwan gloomcheng
At first, the Batch Resize Image module do very simple thing which is call Image::resize method to resize image assets, and I have tried to set breakpoint to confirm the error message happened when
$image->resize()
runs.if ($file->filesize > $threshold_size && ($width > $size_limit || $height > $size_limit)) { // Computing the new height and width based on user input. if ($width > $height) { $width = $size_limit; $height = $height * $width / $width; } else { $height = $size_limit; $width = $width * $height / $height; } // Updating the image size as per set threshold. $image->resize($width, $height); $image->save(); // Chnaging the image size in the database. $file_entity = \Drupal::entityTypeManager()->getStorage('file')->load($file->fid); $file_entity->save(); $result['message'] = '"' . $file->filename . "\" has been transformed."; $context['results']['resized'][] = $result; }
Ref: BatchResizeImageForm.php L102:L122
And then, I have tried to modify to use
$image->scale()
and other methods to validate but get same error.
Therefore, I use alternative similar module Image Compression β to confirm and got the same result, it also faced the issue which can not serialized GdImage object.Finally I decide to switch PHP version to 7.4 and then the module works, so that I guess this issue most related Drupal core.
- πΊπΈUnited States smustgrave
Without the contrib module is this reproducible in core. Sounds like all tests and examples involve using a contrib module that is failing.