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 images are not responsive #5674

Closed
2 tasks
trenzterra opened this issue Mar 17, 2018 · 7 comments · Fixed by #8593
Closed
2 tasks

Gallery images are not responsive #5674

trenzterra opened this issue Mar 17, 2018 · 7 comments · Fixed by #8593
Labels
[Feature] Media Anything that impacts the experience of managing media [Type] Enhancement A suggestion for improvement.
Milestone

Comments

@trenzterra
Copy link

Issue Overview

There is no srcset attribute for images added via Gutenberg's gallery feature, unlike the images function.

Steps to Reproduce (for bugs)

  1. Create a gallery in Gutenberg
  2. Add images
  3. Preview post

Expected Behavior

The SRCSET attribute should be enforced on gallery images allowing the thumbnails to appear.

Current Behavior

The full size image is shown for gallery images, wasting precious data transfer.

Possible Solution

Implement the srcset attribute similar to normal images.

Screenshots / Video

Related Issues and/or PRs

Todos

  • Tests
  • Documentation
@gravnetic
Copy link

All images are not scaling properly, or they are losing their aspect. This is a single image block, and I have confirmed gallery as well.

aspect-issue-in-responsive

@jeffpaul jeffpaul added [Type] Enhancement A suggestion for improvement. [Feature] Media Anything that impacts the experience of managing media labels Mar 21, 2018
@ms-studio
Copy link

It's important to note that, since the introduction of galleries, the default inserted image size for galleries has been "thumbnail" (with the option to change it in the dropdown menu).

Also, a gallery shortcode with no "size" parameter has always resulted in the thumbnail being embedded on the frontend.

Currently, in Gutenberg, galleries are embedding the "full" image. This means that Gutenberg-galleries are pretty much unusable with high-resolution imagery. They will result in hugely bloated pages. In a test run I did with my design students, they created 100+ Mb pages with 10 - 20 images coming straight from their cameras.

@klihelp
Copy link

klihelp commented Apr 25, 2018

For the moment until the thumbnail size options built-in I have reverted back the gutenberg gallery code to the long-time tested [gallery] shortcode:
https://github.com/klihelp/kli_gutenberg_gallery

@mor10
Copy link
Contributor

mor10 commented Jul 23, 2018

Based on my testing of Gutenberg 3.3, Galleries are still outputting the full size images. This causes a significant performance hit when the plugin is installed.

@mor10
Copy link
Contributor

mor10 commented Aug 7, 2018

Adding srcset and sizes to individual gallery images is a start, but it does not fully resolve the issue of the browser loading the wrong image sizes for galleries. Right now the sizes attribute for each gallery image is set as if the displayed image width matches the content width which would only be correct if the gallery has a single column (so almost never). Further refinements need to be introduced (likely through #6177) to resolve this issue. IMO this issue is not resolved and should remain open.

@youknowriad
Copy link
Contributor

youknowriad commented Aug 7, 2018

Granted, we can do better but There's already #1450 for picking sizes for gallery images. Let's avoid duplicates. There's also the issue you point to. The current issue was specificly about the srcset attribute IMO.

@mor10
Copy link
Contributor

mor10 commented Aug 8, 2018

Interestingly I've uncovered a severe bug in current WP around how the sizes attribute is handled when any other image size than thumbnail is chosen for galleries pre-Gutenberg. Will file a Trac ticket and watch to make sure it doesn't carry over into Gutenberg.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Media Anything that impacts the experience of managing media [Type] Enhancement A suggestion for improvement.
Projects
None yet
8 participants