Galleries do not allow width and height to be specified causing AMP issue
- This topic has 9 replies, 2 voices, and was last updated 1 year, 1 month ago by .
March 18, 2021 at 9:58 am #5404mlryan
I recently created a page with two image galleries – neat feature. But, while you can specify alt text for them, you can’t specify the width and height, neither does the processing behind the scenes examine the images and place width and height tags in the final HTML. I noticed this in the AMP version as the rules are strict and Google rejected the page highlighting this issue. Once I had manually editted the HTML of the page to add the width and height tags for the images, Google accepted the changed page met the rules.
The (now corrected) page is at:
Thoughts? Anything I am doing wrong?March 31, 2021 at 7:36 pm #5504Tomasz DziudaApril 6, 2021 at 8:32 pm #5552Tomasz Dziuda
FYI – the issue seems to be related to WebP format – for other image formats it is ok 🙂April 6, 2021 at 8:42 pm #5553Tomasz Dziuda
Ok, I have found a reason – if you are using Jimp as a resize engine (or you just use Linux version of the Publii app) then the images won’t have proper width/height attributes in gallery if they are using WebP. Unfortunately due issues with sharp library on linux, Publii currently does not support WebP on Linux 🙁April 6, 2021 at 8:51 pm #5554mlryan
Thanks for investigating, really appreciate it. Although I am using WebP, I am not using Linux. I use standard Windows 10 version of Publii. I crop my images in Paint.NET and save them as WebP format because I find it gives the best filesize/performance ratio.
The properties of the file saved by Paint.NET appear to be correct. Is it just a more widely spread issue with WebP files in Publii, and not just related to Publii Linux?
I have attached one of the images in the gallery where I noticed the error. This attached image is from before it was imported into Publii.April 7, 2021 at 12:03 pm #5561Tomasz Dziuda
For me your image is working fine – please check if under App Settings you are using “Sharp” as resizing engine for images. If you are using “Jimp” it can explain a reason of your issue.April 7, 2021 at 1:00 pm #5566mlryan
It says Sharp.
Just so you know, it took me 15 minutes to find the App Settings. It is hidden behind a crazy small, almost transparent and un-named icon. You might consider moving it to the left hand menu where everything else is, or at least label it and make it visible.April 7, 2021 at 1:43 pm #5568Tomasz Dziuda
Which version of Publii are you using? 0.38.1 or older one? Older version can also have issues with WebP.April 7, 2021 at 5:28 pm #5569mlryan
I am using 0.38.0
I don’t think it is an issue with the format of the files, the Publii application itself does not give you the option to specify width and height in a gallery like you can for a single image.April 10, 2021 at 10:14 am #5590Tomasz Dziuda
Publii generate image dimensions for images automatically – that’s why we did not add an option in gallery for it.
Please update to the newest version of Publii and then please try to add your WebP image to the gallery again. Support for WebP has been added in 0.38.0 and earlier webp files were ignored in some cases so it could lead to lack of width/height attributes.
- You must be logged in to reply to this topic.