Things I don’t understand about inserting images into posts using Gutenburg.
-
Things I don’t understand about inserting images into posts using Gutenburg. (I have recently upgraded to WordPress 5.1.14)
Here are five extracts from the html of a “latest posts” webpage. Each one is from a post that has an image followed by some text.
<figure class="wp-block-image"><a href="https://www.artprop.org/wordpress/wp-content/uploads/2022/09/IMG_2798.jpg"><img class="alignnone size-large wp-image-78" src="https://www.artprop.org/wordpress/wp-content/uploads/2022/09/IMG_2798-1024x768.jpg" alt="burnt-out car light bulbs" width="1024" height="auto" srcset="https://www.artprop.org/wordpress/wp-content/uploads/2022/09/IMG_2798-1024x768.jpg 1024w, https://www.artprop.org/wordpress/wp-content/uploads/2022/09/IMG_2798-75x56.jpg 75w, https://www.artprop.org/wordpress/wp-content/uploads/2022/09/IMG_2798-300x225.jpg 300w, https://www.artprop.org/wordpress/wp-content/uploads/2022/09/IMG_2798-768x576.jpg 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure> <p><a href="https://www.artprop.org/wordpress/wp-content/uploads/2022/09/IMG_2780.jpg"><img src="https://www.artprop.org/wordpress/wp-content/uploads/2022/09/IMG_2780-1024x962.jpg" alt="ants" width="1024" height="auto" class="alignnone size-large wp-image-53" srcset="https://www.artprop.org/wordpress/wp-content/uploads/2022/09/IMG_2780-1024x962.jpg 1024w, https://www.artprop.org/wordpress/wp-content/uploads/2022/09/IMG_2780-150x141.jpg 150w, https://www.artprop.org/wordpress/wp-content/uploads/2022/09/IMG_2780-300x282.jpg 300w, https://www.artprop.org/wordpress/wp-content/uploads/2022/09/IMG_2780-768x722.jpg 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></p> <p><a href="https://www.artprop.org/wordpress/wp-content/uploads/2022/09/IMG_E2778.jpg"><img class="wp-image-15" src="https://www.artprop.org/wordpress/wp-content/uploads/2022/09/IMG_E2778-970x1024.jpg" sizes="(max-width: 970px) 100vw, 970px" srcset="https://www.artprop.org/wordpress/wp-content/uploads/2022/09/IMG_E2778-970x1024.jpg 970w, https://www.artprop.org/wordpress/wp-content/uploads/2022/09/IMG_E2778-284x300.jpg 284w, https://www.artprop.org/wordpress/wp-content/uploads/2022/09/IMG_E2778-768x811.jpg 768w, https://www.artprop.org/wordpress/wp-content/uploads/2022/09/IMG_E2778-425x449.jpg 425w" alt="" /></a></p> <figure class="wp-block-image"><a href="https://www.artprop.org/wordpress/wp-content/uploads/2022/09/catfight-1.jpg"><img src="https://www.artprop.org/wordpress/wp-content/uploads/2022/09/catfight-1.jpg" alt="cat fight" class="wp-image-70" srcset="https://www.artprop.org/wordpress/wp-content/uploads/2022/09/catfight-1.jpg 704w, https://www.artprop.org/wordpress/wp-content/uploads/2022/09/catfight-1-75x56.jpg 75w, https://www.artprop.org/wordpress/wp-content/uploads/2022/09/catfight-1-300x225.jpg 300w" sizes="(max-width: 704px) 100vw, 704px" /></a></figure> <figure class="wp-block-image"><a href="https://www.artprop.org/wordpress/wp-content/uploads/2022/09/imgp0307a-1.jpg"><img src="https://www.artprop.org/wordpress/wp-content/uploads/2022/09/imgp0307a-1-1024x768.jpg" alt="Hidden Lights photograph" class="wp-image-73" srcset="https://www.artprop.org/wordpress/wp-content/uploads/2022/09/imgp0307a-1.jpg 1024w, https://www.artprop.org/wordpress/wp-content/uploads/2022/09/imgp0307a-1-75x56.jpg 75w, https://www.artprop.org/wordpress/wp-content/uploads/2022/09/imgp0307a-1-300x225.jpg 300w, https://www.artprop.org/wordpress/wp-content/uploads/2022/09/imgp0307a-1-768x576.jpg 768w" sizes="(max-width: 1024px) 100vw, 1024px" /></a></figure>
The only difference I can remember is that some were uploaded when I inserted the image, while others had already been uploaded to the media library and were chosen from there.
They all have appropriate sizes and srcset attributes. Some are inside a figure tag
<figure class="wp-block-image">
Some have width and height attributes
width="1024" height="auto"
Some have class alignnone.
One has no alt data although when viewed in the Media Library it has some.I am not aware of choosing any of these differences.
It is of practical importance because the first image originally had an explicit (and correct) height value which however was rendered incorrectly on iPhone and iPad – the aspect ratio was not correct. I hacked this by changing the height value to “auto” but I would prefer not to have to be on the lookout for this feature in future posts.
- The topic ‘Things I don’t understand about inserting images into posts using Gutenburg.’ is closed to new replies.