amp-wp icon indicating copy to clipboard operation
amp-wp copied to clipboard

Improve Gallery Handling

Open mjangda opened this issue 10 years ago • 9 comments

It's a bit rough right now (see #93 for example) and we just use amp-carousel for all galleries.

  • [ ] Try to respect the type and size settings for the gallery.
  • [ ] Make sure images have sizes.
  • [ ] Maybe incorporate amp-lightbox.
  • [ ] Make sure the get_posts get picked up by object cache (i.e. suppress_filters).
  • [ ] Add captions.

mjangda avatar Feb 03 '16 01:02 mjangda

As a suggestion, it'd be nice to add a filter to the URL on the images being added to the gallery, so CDN or other manipulations could be done on them.

j3j5 avatar Feb 17 '16 00:02 j3j5

That seems like a good idea, although, shouldn't CDNing the URL happen at a lower level like wp_get_attachment_url? What other manipulations would you like to do?

mjangda avatar Feb 17 '16 05:02 mjangda

Can I add some suggestions?

When the default wordpress gallery has captions and links they aren't translated to AMP version. You can check an example by the end of this link, before sharing buttons. That's affiliate links and are fundamental to this website.

  • [ ] add link to image carousel
  • [ ] add caption to image carousel

Thanks!

cassianotartari avatar Oct 11 '16 13:10 cassianotartari

Another vote for captions by pako69 here.

See the "Text Overlay" section here: https://ampbyexample.com/advanced/image_galleries_with_amp-carousel/

mjangda avatar Oct 13 '16 23:10 mjangda

I'll take a look tomorrow, I'll study the code and try to submit a PR. My priority are the links in the carousel images.

cassianotartari avatar Oct 13 '16 23:10 cassianotartari

I'm not a Wordpress programmer but I was looking how to get alt attribute to add as caption and I found this:

$alt_txt = trim(get_post_meta($attachment_id, '_wp_attachment_image_alt', true));

But when I try to use it under AMP_Gallery_Embed_Handler class it return a empty string. I was trying to call it right here: https://github.com/Automattic/amp-wp/blob/master/includes/embeds/class-amp-gallery-embed.php#L91

cassianotartari avatar Oct 21 '16 10:10 cassianotartari

From the above, it looks as if captions in galleries hasn't yet been implemented. Are there any thoughts on when this might be implemented?

A WordPress VIP client is asking about this.

dartiss avatar Jun 26 '17 12:06 dartiss

Any updates on captions? It is the only thing making my AMP page incomplete.

trenzterra avatar Aug 27 '17 15:08 trenzterra

As of upcoming 1.0 the galleries support lightboxes and the carousel is optional, allowing you to use whatever your active theme is doing since the templates get served in AMP.

westonruter avatar Jun 24 '18 06:06 westonruter