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

Issue with cropping in 0.4.7? #238

Closed
tusamni opened this issue Apr 27, 2021 · 8 comments
Closed

Issue with cropping in 0.4.7? #238

tusamni opened this issue Apr 27, 2021 · 8 comments
Labels
bug Something isn't working

Comments

@tusamni
Copy link

tusamni commented Apr 27, 2021

I was on 0.4.5 and cropping seems to be fine, however on 0.4.7 suddenly the crops are all way off. I rolled back to 0.4.5 and confirmed that the bug is gone.

I'm using static IPX.

@tusamni
Copy link
Author

tusamni commented Apr 27, 2021

On 0.4.5, my image URL's in dev look like:
/_ipx/image.jpg?f=webp&s=1000_667

On 0.4.7, they change to :
/_ipx/image.jpg?f=webp&_cHeight=1500&s=1000_1333

@tusamni
Copy link
Author

tusamni commented Apr 28, 2021

It's something to do with the "sizes" attribute, but I haven't been able to figure it out yet.

@tusamni
Copy link
Author

tusamni commented Apr 28, 2021

Well, I'm still not sure of the issue, but I think it's got to do with the height property on srcset, for some reason they're all set to "1333" which is the original height.

<img src="/_ipx/posts/new-camera-and-lenses/ice-metallic-green-930.jpg?f=webp&amp;_cHeight=1500&amp;s=2000_1333" width="2000" height="1333" alt="Ice Metallic Green 930 Turbo"
    sizes="(max-width: 320px) 100vw, (max-width: 640px) 100vw, (max-width: 768px) 100vw, 1000px"
    srcset="
        /_ipx/posts/new-camera-and-lenses/ice-metallic-green-930.jpg?f=webp&amp;_cHeight=480&amp;s=320_1333 320w,
        /_ipx/posts/new-camera-and-lenses/ice-metallic-green-930.jpg?f=webp&amp;_cHeight=960&amp;s=640_1333 640w,
        /_ipx/posts/new-camera-and-lenses/ice-metallic-green-930.jpg?f=webp&amp;_cHeight=1152&amp;s=768_1333 768w,
        /_ipx/posts/new-camera-and-lenses/ice-metallic-green-930.jpg?f=webp&amp;_cHeight=1500&amp;s=1000_1333 1000w"
     class="transition-all ease-in-out shadow-lg hover:shadow-xl transition-1000">

@pi0 pi0 closed this as completed in 5e28edd Apr 28, 2021
@pi0
Copy link
Member

pi0 commented Apr 28, 2021

Hi @tusamni. Can you please try 0.4.8?

@tusamni
Copy link
Author

tusamni commented Apr 28, 2021

Hey @pi0 thanks.

Still having issues. If I include the "sizes" attribute on an image it's giving me a weird crop. In the attached image below, I have the "sizes" attribute on the first image, but the other two don't have it and show correctly.

Screenshot_1

The generated code for that image is:

<img src="/_ipx/pages/photography/recent02.jpg?f=webp&amp;_cHeight=525&amp;s=350_2000" width="1333" height="2000" alt="Singer 911 in LA" sizes="(max-width: 320px) 100vw, (max-width: 640px) 100vw, (max-width: 768px) 300px, (max-width: 1024px) 350px, (max-width: 1280px) 350px, 350px" srcset="/_ipx/pages/photography/recent02.jpg?f=webp&amp;_cHeight=480&amp;s=320_2000 320w, /_ipx/pages/photography/recent02.jpg?f=webp&amp;_cHeight=960&amp;s=640_2000 640w, /_ipx/pages/photography/recent02.jpg?f=webp&amp;_cHeight=450&amp;s=300_2000 300w, /_ipx/pages/photography/recent02.jpg?f=webp&amp;_cHeight=525&amp;s=350_2000 350w, /_ipx/pages/photography/recent02.jpg?f=webp&amp;_cHeight=525&amp;s=350_2000 350w, /_ipx/pages/photography/recent02.jpg?f=webp&amp;_cHeight=525&amp;s=350_2000 350w" class="transition-all ease-in-out shadow-lg hover:shadow-xl transition-1000">

And my code looks like:

source: "/pages/photography/recent02.jpg",
description: "Singer 911 in LA",
width: 1333,
height: 2000,
sizes: "xs:100vw sm:100vw md:300px lg:350px xl:350px 2xl:350px",

@tusamni
Copy link
Author

tusamni commented Apr 28, 2021

I'm no expert at this, but it looks like it's the "?s=" attribute on the image URLs. The width is set correctly, but the height is the original height.

@pi0 pi0 reopened this Apr 28, 2021
@danielroe danielroe added the bug Something isn't working label Apr 28, 2021 — with Volta.net
@tusamni
Copy link
Author

tusamni commented Apr 28, 2021

So I can provide a little more insight here.

I have two identical images, just slightly different sizes: one is 1000x667 and one is 2000x1333.

My sizes option looks like this:

sizes: "md:100vw lg:510px"

The 1000px image crops fine, the 2000px one is far too tall.

1000px: dodge-demon-rear-wheel-Custom.jpg?f=webp&_cHeight=512&s=768_667
2000px: dodge-demon-rear-wheel.jpg?f=webp&_cHeight=512&s=768_1333

Screenshot_2

@danielroe
Copy link
Member

I believe this has been resolved (see 682b674). If not, do let me know and I'll happily reopen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants