-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Position syntax using FPF with Imager and Eager Loaded Images #10
Comments
That looks correct to me. What's the error you're seeing? |
I get an "Undefined offset: 1" PHP notice. Specifically, it says the error is at: craft/plugins/imager/services/ImagerService.php(914), which is... |
Weird. Since you're mentioning eager loading, does it work if you don't eager-load? |
There must be something wrong with the value that is being passed in, that space in '30% 40%' maybe isn't a space? Is '30% 40%' the default value you've assigned to the field? Try erasing the value, write it again, save, and check again. Also, what happens if you replace the position part with |
+1 |
@aelvan I tried removing the positions, but I get the same error. I also replaced the position to what you wanted me to try out, but I get the same error. |
Can you try opening up craft/plugins/imager/services/ImagerService.php, right before line 914 add Is there only this one image on the page, or several? If there're more than one, can you try to make a minimal test case with only one and see if you still get the error. |
@aelvan Hi Andre, Sorry about the late reply. I reduced the images down to one on the page and added the line of code as you instructed. Here's the error message: |
Any progress on this? I'm getting the same error. |
Yeah, this keeps popping up from time to time, and the reason is always that an invalid value is being passed. I'd check (and double check) that the default values that is set in the config and on the field(s), are correct. It's suppose to be |
Ah, I see what the issue is. You HAVE to input a default value for the FocalPoint field. For some reason the default value FocalPoint says it will output doesn't get outputted if you leave it blank. So looping over an image array with some images having a focal point and some not was causing the error. As soon as I added a default value ( |
Ok, that sounds like a bug. I'll have a look at it. |
I got the same problem. While waiting for a fix, is there a simple code solution I can use, instead of looping through all images and giving them a default value? |
@samlous All you have to do is put the default value in the Focal Point Field when you create it, not every time you insert images in the code. Once that default value is there you should be fine. |
I'm having trouble getting the correct syntax for my FPF field when I'm using it with Imager with eager-loaded images. Specifically, I'm not sure what follows "position: " because this doesn't seem to work:
When I test out {{ image.focalPointField }}, it outputs the correct percentages that I set for my image positions (e.g. '30% 40%'). However, it doesn't seem to work within the Imager code syntax. Any guidance would be great!
The text was updated successfully, but these errors were encountered: