Unable to resize image fields with maximum image dimensions

Created on 26 August 2024, 3 months ago
Updated 11 September 2024, 3 months ago

Problem/Motivation

When I upload am image that is larger than an image fields set maximum image dimensions. I get the following error.

The image exceeds the maximum allowed dimensions and an attempt to resize it failed.

Using the GD toolkit I get no errors and it is resized properly.

Image styles that resize the image are working properly. I am only seeing this with max dimensions in the image field itself

Steps to reproduce

Version information

Version: ImageMagick 6.9.10-68 Q16 x86_64 2024-04-16 https://imagemagick.org
Copyright: © 1999-2019 ImageMagick Studio LLC
License: https://imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP(3.1) 
Delegates (built-in): bzlib cairo fontconfig freetype gslib jng jp2 jpeg lcms ltdl lzma openexr pangocairo png ps rsvg tiff wmf x xml zlib
🐛 Bug report
Status

Fixed

Version

4.0

Component

Code

Created by

🇺🇸United States loze Los Angeles

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Merge Requests

Comments & Activities

  • Issue created by @loze
  • Recently ran into the same issue after a series of core and server updates including the ImageMagick util, unfortunately it was discovered by an editor a few weeks after the updates so I'm not sure what part of the updates may have caused the problem to arise. The failure to scale is also accompanied by a warning in the site log.

    The image toolkit 'imagemagick' failed processing 'scale' for image '/tmp/phpxyz'. Reported error: TypeError - round(): Argument #1 ($num) must be of type int|float, string given

  • Merge request !43Cast width and height as integers → (Merged) created by loze
  • Status changed to Needs review 3 months ago
  • 🇺🇸United States loze Los Angeles

    Thanks for the hint @jessica.k that is indeed what was happening. Apparently with php 8.0+ round fails if the variable is a string.

    I've created a MR which casts the with and height variables as integers.

    There may be other places in this module that we need to do this for, but for now this solves my original issue.

    Here's a patch to use with composer.

  • Pipeline finished with Failed
    3 months ago
    Total: 1033s
    #266480
  • Pipeline finished with Skipped
    3 months ago
    #266696
  • First commit to issue fork.
  • Status changed to Fixed 3 months ago
  • 🇮🇹Italy mondrake 🇮🇹

    Thank you.

  • 🇮🇹Italy mondrake 🇮🇹

    Released 4.0.2 with the fix in.

  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024