Archived topic
"Specify image dimensions" notice for logo by gtmetrix
11 replies · Started by Anil on April 4, 2020
GPP not populating logo size. Please guide.
Hi there,
Can you try setting a logo width option?
https://docs.generatepress.com/article/adding-header-logo/
Let me know :)
I did, but it is not generating image dimensions...
Hi there,
did you resolve the issue ? If its not resizing can you disable Autoptimize and any other caches being used and try again. Let us know
Hi David, it is not resolved, disabled cache.
What size do you have it set to in the Customizer ?
Can you also make sure the Customizer settings are Published and not Saved as Draft
Let me know
It is 40x40.
I believe function for logo output not populating the image dimension...
aah ok - Tom provides a filter to add them here:
https://wordpress.org/support/topic/adding-width-and-height-attributes-to-logo/#post-9397089
Unfortunately you will need to add the sizes to the function.
Thanks David, it works.
I feel it should be automatically done by the function there, we should not provide the dimension every time we change the size of logo.
Can we add dimension automatically in above by reading the size of logo?
As the logo is resized using CSS it shouldn't really matter what sizes you use.
Especially if it is just to get rid of the GTMetrix notice.
BTW: GP will add width=100 and height=100 to the img if you also add a Retina Image - this is to get round a legacy bug in Firefox. That may be your simplest fix.
Does this need to be done differently for sticky nav?
Is there a way to get this into the theme to handle it by default, its little things like this that can be the difference between 99% and 100% in gtmetrix ;-)
You can use the Navigation Logo here:
https://docs.generatepress.com/article/generate_navigation_logo_output/#examples
Or just add a Retina logo to the Site Identity and it will automatically add 'some' dimensions.