2

I'm using eager loading for retrieving some images for my gallery:

{% set employments = craft.entries({ section: 'employments', with: ['photo] }) %}

This works fine and I can see all images on my page.

I'm using focuspoint (https://github.com/smcyr/Craft-FocusPoint) with imager for resizing the images. I've set a different focuspoint for every image. But whenever I try to get the focuspoints of a image: photo[0].focusPctX, all images have the same focuspoints (50).

Whenever I try to retrieve the images without the eager loading function, it works fine.

I've created a new issue @focuspoint github.

Is there someone that had the same problem, or has a solution for this?

  • same issue here. Did you ever resolve this? – mention79 Jul 9 '17 at 16:21
  • 1
    Created a answer for you ;) – Mr. Sam Jul 10 '17 at 13:49
  • thanks, I'll have a look at the other focalpoint plugin then, as use it on every image. So definitely need it. – mention79 Jul 10 '17 at 14:02
2

I ran into this issue too and had landed on this thread (and another similar one). I was able to piece together a solution using the modify elements query method. I wrote a pull request that got merged, so lazy-loading works with this plugin as of version 1.1.4.

4

After some research I found out that this problem has no simple solution (unfortunately). Check https://github.com/smcyr/Craft-FocusPoint/issues/10.

A solution would be not to use eager loading (obvious). Another solution could be using Craft3 (no plugin needed).

The solution I used was Focal Point (https://github.com/aelvan/FocalPointField-Craft). Focal Point is a tool that can be used with Eager Loading. Focal Point creates a focus point on every asset, that means not on every asset field.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.