Craft-FocusPoint icon indicating copy to clipboard operation
Craft-FocusPoint copied to clipboard

Focus Point coordinates lost if eager loaded?

Open MattWilcox opened this issue 7 years ago • 4 comments

When I eager load a focus point asset the output image no longer crops around the focal point, but if I revert back to lazy loading it works as expected?

In the below code, listingImage is a focuspoint field.

{% set workItemsEager = craft.entries({ section: 'work', limit: 8, with: [ 'listingImage', ] }) %}

{% set transformedImages = craft.imager.transformImage(image,[ { width: 500, height: 500, jpegQuality: 60 }, { width: 320, height: 320, jpegQuality: 60 }, ],{ allowUpscale: false, mode: 'crop', position: image.focusPctX ~ '% ' ~ image.focusPctY ~ '%', interlace: true }) %}

When outputting a transformed image from this code, the position is ignored. If I remove the "with" lines the focus point is retained.

MattWilcox avatar Oct 12 '17 10:10 MattWilcox

To clarify, it looks like I still have access to image.focusPctX and image.focusPctY when eager loaded, but the value reported is incorrect, it appears to be centered?

MattWilcox avatar Oct 20 '17 14:10 MattWilcox

+1 for this issue. Having the same problem when trying to use it on eager loaded elements.

jan-dh avatar Feb 05 '18 09:02 jan-dh

Did anyone come up with a solution for this issue?

terryupton avatar Mar 28 '18 14:03 terryupton

@MattWilcox Did you manage to resolve this at all?

terryupton avatar Apr 26 '18 14:04 terryupton