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

Almost none of the images honour the dimension setting #10

Closed
kartagis opened this issue Feb 7, 2017 · 4 comments
Closed

Almost none of the images honour the dimension setting #10

kartagis opened this issue Feb 7, 2017 · 4 comments

Comments

@kartagis
Copy link

kartagis commented Feb 7, 2017

Hello,
Even though I've explicitly specified dimension to be 150, all of the images

  • Are 100px in the DOM
  • Even with that, their dimensions are wrong.

Please see the below screenshot from chrome://inspect.

screenshot 2017-02-07 10 45 26

@kartagis kartagis changed the title Almost none images honour the dimension setting Almost none of the images honour the dimension setting Feb 7, 2017
@domax
Copy link
Owner

domax commented Feb 7, 2017

  1. Your HTML <img> element contains width attribute that is set to "100", so that browser tries to render it with this width, ignoring height attribute. Informing the Browser — the actual purpose of width attribute, and see also The Proper Use of height. If you want to render your image neglecting its recommended dimensions (img's width and height attributes), you should use CSS width and height properties.
  2. As far I can get from your screenshot, top row of your photo grid are panoramas - such a photos have very long width and short height. At the left side of screenshot you have a balloon where you can see an original (natural) dimensions of your panorama thumbnail: 150 x 28 pixels.

I cannot see any issues depending on this plugin.

@domax
Copy link
Owner

domax commented Feb 7, 2017

Just in case: thumbnail() function does not make any padding/color-filling in thumbnails - it just resizes an original image to desired dimension you specify in options. Aspect ratio is preserved. To compute a thumbnail size, it uses the following algorithm:

cf = dimension / max(image.width, image.height)
thumbnail.width = image.width * cf
thumbnail.height = image.height * cf

@kartagis
Copy link
Author

kartagis commented Feb 7, 2017 via email

@domax
Copy link
Owner

domax commented Feb 7, 2017

Exactly

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

No branches or pull requests

2 participants