Focal point scale by width and imagemagick

Created on 21 August 2024, 5 months ago

Problem/Motivation

When using the focal point scale by width style added here: https://www.drupal.org/project/focal_point/issues/2997675 Provide image effect to scale by width only RTBC along with imagemagick I get this error:

The image toolkit ‘imagemagick’ failed processing ‘crop’ for image ‘public://2023-09/image-test.jpg’. Reported error: TypeError - round(): Argument #1 ($num) must be of type int|float, string given

Steps to reproduce

  • Install imagemagick: https://www.drupal.org/project/imagemagick and set this to the default toolkit.
  • Create image style that uses Focal point by width and then try to set the image style on a particular image by going to something like: /sites/default/files/styles/focal_point_width_image_style/public/2024-08/sample.png
  • You should be able to see the error listed in the Problem/Motivation section above in the logs

Proposed resolution

I've cast all of the values as integers when passing to the crop() function

🐛 Bug report
Status

Needs review

Version

2.1

Component

Other Code

Created by

🇬🇧United Kingdom samberry

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

Comments & Activities

Production build 0.71.5 2024