DeuxHuitHuit / craft-cloudflare-images

Upload your images assets to Cloudflare Images from Craft CMS assets interface. Configure Craft's transform to use it.
https://plugins.craftcms.com/cloudflare-images
Other
1 stars 1 forks source link

Issue with the gravity parameter not populated correctly #3

Closed ebarbe-globalia closed 1 month ago

ebarbe-globalia commented 4 months ago

When using the plugin to transform images, the gravity parameter expected by Cloudflare is not populated as expected.

The Cloudflare Image Optimization documentation requires that the gravity parameter is filled with either auto or a "side", defined like this:

A side ("left", "right", "top", "bottom") or coordinates specified on a scale from 0.0 (top or left) to 1.0 (bottom or right), 0.5 being the center. The X and Y coordinates are separated by lowercase x in the URL format. For example, 0x1 means left and bottom, 0.5x0.5 is the center, 0.5x0.33 is a point in the top third of the image.

The plugin currently sends the value of position from the ImageTransform model to the gravity property. It does not work as the value of position does not match the requirement expected by Cloudflare.

Currently, using the plugin, our images transforms requests return: ERROR 9401: Missing or invalid resizing parameters: gravity keyword is not one of the supported values

There needs to be a transformation done so the value of gravity is computed from position and matches the expected value.


For context, we are storing source assets locally and using a Cloudflare Image volume for the transforms only.

nitriques commented 1 month ago

Hey @ebarbe-globalia

Sorry for the late response. We will try to look into this ASAP.

nitriques commented 1 month ago

Hey @ebarbe-globalia We made a fix and will release a new version right now. Thanks again.