gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Gallery: choosing thumbnail size

Open mtias opened this issue 9 years ago • 35 comments

This is not a great experience in core at the moment, but since some themes / people may be relying on specific thumbnail generation for galleries, it'd be good to offer that option in the inspector, to choose a specific thumbnail size from the registered ones.

mtias avatar Jun 26 '17 12:06 mtias

A consideration is that these options can currently be filtered in core with the image_size_names_choose filter.

paulwilde avatar Jun 26 '17 13:06 paulwilde

@mtias by "thumbnail size" I assume you referring to a registered image size. If that is the case this might be an issue because the registered image size may not have an image size stored in the upload directory, as adding an image size does not resize the currently uploaded images.

kopepasah avatar Jun 29 '17 11:06 kopepasah

I see @mkaz and @jasmussen are assigned this issue (as of this comment). Are either of you currently working on this implementation?

kopepasah avatar Jun 29 '17 11:06 kopepasah

Are either of you currently working on this implementation?

I'm not, and I don't think Marcus has started yet either. We have a few other tickets to look at also, https://github.com/WordPress/gutenberg/issues/assigned/mkaz so please feel free to take this one if you're feeling adventurous, would really apprecaite it. Worst case, you can push your work early, and ping us, and we can work together.

💓

jasmussen avatar Jun 29 '17 11:06 jasmussen

Correct, I'm still working on #1444 #1445 and #1447 which all involve gallery & media modal - so haven't started on this one yet

mkaz avatar Jun 29 '17 13:06 mkaz

Reassigned this one to you, @kopepasah, but if it drops off your radar for any reason (understandable), just ping us and we'll be back on!

jasmussen avatar Jun 29 '17 14:06 jasmussen

If "image block" has a combo box to choose from registered image sized I don't understand the hesitation to provide a similar mechanism for the gallery block. In both cases there is a possibility that user may not have an image size stored in the upload directory, but looking at popularity of "Regenerate Thumbnails" plugin people are aware how to deal with it (by the way it is strange that core allow changing image sizes assigned to medium and large names but has no option to handle already uploaded files).

Axinet avatar Oct 13 '17 12:10 Axinet

This ticket was mentioned in Slack in #core-editor by jeffpaul. View the logs.

jeffpaul avatar Feb 22 '18 22:02 jeffpaul

Would be great if there is a solution to this (even as an intermediary step until there is better image size support/foundation in core as mentioned in the slack channel)

Think of all users that are uploading images in full sizes. This quickly adds big amounts of traffic to a site.

fabianpimminger avatar Mar 05 '18 15:03 fabianpimminger

+1

klihelp avatar Mar 08 '18 22:03 klihelp

Inserting huge full size images would break the page. Thumbnails also needed for Lightbox modules.

radogado avatar Mar 09 '18 08:03 radogado

Could the proposed UI enhancements for images work for this as well? https://github.com/WordPress/gutenberg/issues/4914

jasmussen avatar Mar 09 '18 08:03 jasmussen

A fix until thumbnails comes in - replace the gallery block with the gallery shortcode https://github.com/klihelp/kli_gutenberg_gallery

klihelp avatar Mar 20 '18 19:03 klihelp

I think the images in the gallery block should at least support the srcset attributes? Then the browser should be able to load only the image with an appropriate size?

fabianpimminger avatar Jul 08 '18 13:07 fabianpimminger

@fabianpimminger Adding srcset and sizes only partially resolves the issue. See #6177

mor10 avatar Aug 07 '18 23:08 mor10

As a temporary fix (Gutenberg + Advanced Gutenberg for lightbox effect):

  1. Install a @klihelp 's plugin
  2. Fix it
  3. Fix it

DrYurets avatar Aug 23 '18 19:08 DrYurets

Think of all users that are uploading images in full sizes. This quickly adds big amounts of traffic to a site.

Like @fabianpimminger said. Currently full-sized images are being loaded when I use the gallery block on a website. This isn't accessible for people on a slow internet-connection and an unnecessary waste of resources.

I would expect the possibility to choose which image-size I want to load. Just like @mtias proposed in the opening of this issue.

erikjoling avatar Sep 18 '18 11:09 erikjoling

Please store image attachment IDs in JSON comment blocks (<!-- wp:gallery --> and <!-- wp:image -->). So content can be easily filtered by backend code.

In the current version of Gutenberg only wp:image stores attachment ID, wp:gallery - doesn't.

If this won't happen, every plugin or theme that wants to modify Gutenberg gallery HTML markup needs to create another block. Which breaks backward's compability.

More info at: https://github.com/WordPress/gutenberg/issues/8193

markfinst avatar Oct 05 '18 07:10 markfinst

I think @markfinst 's recommendation is a good one. (storing ids.) There are a few instances I could see this being useful:

  1. Gallery shortcode fallbacks to respect older filters will likely rely on ids ( https://github.com/WordPress/gutenberg/issues/1451)
  2. https://github.com/WordPress/gutenberg/issues/10994 - though this issue may be a little more complicated than just getting all the ids to a single REST request, having ids stored will help make that an option.
  3. extendability
  4. transform possibilities

For https://github.com/WordPress/gutenberg/issues/1451 I am exploring a classic-gallery block that allows for inspector controls in the sidebar. A temporary solution to this issue would be transforming large galleries to a shortcode or classic-gallery block. If we had the ids stored, this would be easy to adjust to. @mtias, I wanted to bring this one to your attention as we continue to discuss the possibility of a classic-gallery block.

screen shot 2018-10-28 at 3 33 33 pm

Here's the branch where I am building the classic-gallery block: https://github.com/antpb/gutenberg/tree/add/classic-gallery

antpb avatar Oct 28 '18 21:10 antpb

We are consolidating image handling improvements in https://github.com/WordPress/gutenberg/issues/6177. This is a good opportunity to avoid offloading the responsibility of determining the right size (performance, weight, quality) to the user and the engine doing it instead with responsiveness in mind.

Moving this out of 5.0 as there could still be some additions to the gallery block around showing certain cropped thumbnails as options, but it needs a better presentation as well.

mtias avatar Nov 14 '18 16:11 mtias