[wp-trac] [WordPress Trac] #47922: src attribute in Image Gallery Block is inconsistent with image inserted outside of gallery.
WordPress Trac
noreply at wordpress.org
Thu Aug 22 17:20:40 UTC 2019
#47922: src attribute in Image Gallery Block is inconsistent with image inserted
outside of gallery.
--------------------------+-----------------------------
Reporter: bbogart | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Gallery | Version: 5.2.2
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Steps:
1. Create an Image Gallery Block.
2. Upload an Image
3. Select "Link To" "Media File"
4. Preview / Publish post.
== What I expect to happen:
A thumbnail of my uploaded image shown in the gallery that links to the
original uploaded image. i.e. The behaviour should be consistent with
images inserted outside of galleries.
I expect the resulting source to look like this: (The same as it would be
if the image was outside of a gallery)
{{{
<figure class="wp-block-image"><a href="http://www.ekran.org/ben/wp/wp-
content/uploads/2019/08/23.sigma35.e0.5.png"><img
src="http://www.ekran.org/ben/wp/wp-
content/uploads/2019/08/23.sigma35.e0.5-420x530.png" alt="" class="wp-
image-4868" srcset="http://www.ekran.org/ben/wp/wp-
content/uploads/2019/08/23.sigma35.e0.5-420x530.png 420w,
http://www.ekran.org/ben/wp/wp-
content/uploads/2019/08/23.sigma35.e0.5-238x300.png 238w,
http://www.ekran.org/ben/wp/wp-
content/uploads/2019/08/23.sigma35.e0.5-768x970.png 768w,
http://www.ekran.org/ben/wp/wp-
content/uploads/2019/08/23.sigma35.e0.5-811x1024.png 811w,
http://www.ekran.org/ben/wp/wp-content/uploads/2019/08/23.sigma35.e0.5.png
1109w" sizes="(max-width: 420px) 100vw, 420px" /></a></figure>
}}}
== What actually happens:
The gallery uses the 1024x sized images that link to the same 1024px sized
images, seemingly ignoring the "Link to" "Media File" specification. The
1024px down-scaled image seems to be selected arbitrarily and the visitor
cannot access the full-sized image by clicking on the image in the
gallery.
This is the corresponding source I actually get:
{{{
<figure><a href="http://www.ekran.org/ben/wp/wp-
content/uploads/2019/08/23.sigma35.e0.5-811x1024.png"><img
src="http://www.ekran.org/ben/wp/wp-
content/uploads/2019/08/23.sigma35.e0.5-811x1024.png" alt="" data-
id="4868" data-link="http://www.ekran.org/ben/wp/2019/early-full-
resolution-explorations/23-sigma35-e0-5/" class="wp-image-4868"
srcset="http://www.ekran.org/ben/wp/wp-
content/uploads/2019/08/23.sigma35.e0.5-811x1024.png 811w,
http://www.ekran.org/ben/wp/wp-
content/uploads/2019/08/23.sigma35.e0.5-420x530.png 420w,
http://www.ekran.org/ben/wp/wp-
content/uploads/2019/08/23.sigma35.e0.5-238x300.png 238w,
http://www.ekran.org/ben/wp/wp-
content/uploads/2019/08/23.sigma35.e0.5-768x970.png 768w,
http://www.ekran.org/ben/wp/wp-content/uploads/2019/08/23.sigma35.e0.5.png
1109w" sizes="(max-width: 811px) 100vw, 811px" /></a></figure>
}}}
Seems the offending issues are that:
a. the href points to the down-scaled image, not the media file.
b. {{{sizes="(max-width: 811px) 100vw, 811px"}}} when it should be
{{{sizes="(max-width: 420px) 100vw, 420px"}}} where 420px is my default
thumbnail size.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/47922>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list