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

gallery.js: Wrong image sizes in attributes #11548

Closed
tobiaseichert opened this issue Jan 28, 2020 · 3 comments
Closed

gallery.js: Wrong image sizes in attributes #11548

tobiaseichert opened this issue Jan 28, 2020 · 3 comments
Labels
bug [triage] something behaving unexpectedly help wanted [triage] Ideal issues for contributors to help with

Comments

@tobiaseichert
Copy link

Issue Summary

A summary of the issue and the browser/OS environment in which it occurs.

To Reproduce

  1. Create a new post. Inside the post, pull an image (preferably > 2000x1500) to the gallery card, the correct image dimensions are inserted as seen in the browser developer tools.
  2. Save the post and publish it.
  3. Have a look at the published content. The original image has been replaced by an optimised version (2000x1500); however the image width and height attributes still carry the dimensions of the original image. This may lead to problems when using additional gallery related libraries like a lightbox.

Technical details:

  • Ghost Version: 3.2.0
  • Node Version: 10.18.1
  • Browser/OS:
  • Database: MySQL

image_dimensions

@ErisDS ErisDS added bug [triage] something behaving unexpectedly help wanted [triage] Ideal issues for contributors to help with labels Apr 20, 2020
@stale
Copy link

stale bot commented Jul 19, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale [triage] Issues that were closed to to lack of traction label Jul 19, 2020
@stale stale bot closed this as completed Jul 26, 2020
@jdcauley
Copy link

Can some one assign me I can look at this week after next?

@ErisDS ErisDS removed the stale [triage] Issues that were closed to to lack of traction label Jul 27, 2020
@ErisDS
Copy link
Member

ErisDS commented Jul 27, 2020

I can and have reopened this.

@ErisDS ErisDS reopened this Jul 27, 2020
sainthkh added a commit to sainthkh/Ghost that referenced this issue Sep 14, 2020
issue TryGhost#11548

The cause of the problem was the server resizing images whose width is over 2000px. (core/server/web/api/middleware/normalize-images.js)

To solve this problem, I introduced a new function `normalizeImageSizes` under `core/server/lib/mobiledoc.js`. It loops cards and checks if images and galleries have images whose width is over 2000px and normalize them.
kevinansfield added a commit to TryGhost/Koenig that referenced this issue Oct 19, 2020
refs TryGhost/Ghost#11548

- use `options.imageOptimization.maxDefaultWidth` to calculate correct width/height for gallery card images when image transformation is enabled and a the image will have been resized to fit the max width
  - this won't break themes because we already output width/height for gallery images and the aspect ratio stays the same
- added code ready for image card width/height but left it commented out for now because adding width/height is a breaking change in themes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug [triage] something behaving unexpectedly help wanted [triage] Ideal issues for contributors to help with
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants