Skip to content
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

Preview doesn't match Imager #9

Open
spAnser opened this issue Nov 29, 2016 · 2 comments
Open

Preview doesn't match Imager #9

spAnser opened this issue Nov 29, 2016 · 2 comments

Comments

@spAnser
Copy link

spAnser commented Nov 29, 2016

screen shot 2016-11-29 at 1 20 04 pm|
screen shot 2016-11-29 at 1 20 42 pm
-|-
Focus Point back end | Imager front end

The preview doesn't appear to be matching the imager crop.

focusPctX = 68.5%
focusPctY = 59%

{% set transformedImage = craft.imager.transformImage(image, { width: 387, height: 587, position: image.focusPctX ~ '% ' ~ image.focusPctY ~ '%', allowUpscale: false }) %}

Heights are 187 or 387 or 587

The hidden input fields show
data-focus-x = 0.37
data-focus-y = -0.18

Example image from Pexels

If this is an imager bug feel free to close and let me know.

@smcyr
Copy link
Owner

smcyr commented Dec 19, 2016

Hey, sorry for the late response.

I think it's because Imager calculate the position the image like the CSS background position instead of the calculation jQuery Focuspoint does. See the explanation by jQuery Focuspoint here:
https://github.com/jonom/jquery-focuspoint#pure-css-alternative

Let me know if you think it's still a bug. Thanks!

@spAnser
Copy link
Author

spAnser commented Dec 19, 2016

I mainly consider this a bug because you have a imager example in the readme and technically it is calculating differently. So even though the example is there and works in most cases just fine. Maybe we should see if there is a math conversion to fix the settings for the purposes of the example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants