Fix the Image Elements Do Not Have Explicit Width and Height Issue | PageSpeed Insights | Snippet
Вставка
- Опубліковано 16 жов 2024
- Get around this issue with a snippet as it's not the easiest thing to resolve. This how you Fix the Image Elements Do Not Have Explicit Width and Height Issue | PageSpeed Insights | Snippet.
The Code Snippet required is:
websquadron.co...
Book your 1-2-1 Consultation: websquadron.co...
We love to create - share - respond - and deliver.
🧐 Learn with our Mastery Modules: websquadron.co...
🔗 All of our Important Links: websquadron.co...
😃 Join our Facebook Group: / 3309523509284305
😃 Get Code Snippets Pro: r.freemius.com...
😃 Get Elementor Pro: be.elementor.c...
😃 Boost your UA-cam Analysis: www.tubebuddy....
👕 Get our Merchandise: websquadron.co...
🥹 Support us: paypal.me/Webs...
Hire us to work on your Website!
💌 info@websquadron.co.uk
👩💻 Visit websquadron.co.uk
This is the Snippet to use: websquadron.co.uk/fix-explicit-image-width-and-height/
bro, the snippet doesn't work, speedsights still shows up the
Image elements do not have explicit width and height, please advice
Same thing Images not showing
@@davidokon2988 I can't comment anymore on your site as something else may affect it. Use a backup if you still can't see them. Only as part of a 1-2-1 could I investigate further.
it works for me! Thanks. And for those who are talking about not installing Code Snipets plugin, you can always create your own light plugin, just remember to add
defined('ABSPATH') or die('Oh no no no... dont be like that');
Greetings from Cuba
Great to hear!
Your an absolute Genius! I did this fix in less than a minute thanks to you! BIG thumbs up and thank you VERY much for helping me with this video!
Hello there!
Just tried, but now the PageSpeed isn't able to scan the website, it shows the following error message:
"Unable to Resolve {url}. Try checking the URL for validity."
Just checked the and it works normally...
I've read the comments here, so it might be because I have some carousels and a slider.
Guess I'll have to live without the explicit width and height for image elements
I do have a version of the code if you have Carousels - see here: learn.websquadron.co.uk/wordpress-page-speed/
Scroll down the page and you will see it.
@@websquadron Hello! Thanks for the quick response! I was probably watching this very video with the update snippet at the time you answered, but have just seen your answer now...
I've tested is, but unfotunately it didn't work either
Hi, I added the code and it worked, but it ended up causing another problem, I have some posts with lots of images and when this page is accessed, it stays on a white screen until it stops responding. If I deactivate the plugin with the code, it goes back to normal. :/
Did you have a carousel or slider on the screen?
@@websquadron I use the slider on the screen, the images are distributed in the text content of the post. I noticed problems with loading because the prints started to drop, I disabled the script and it went back to normal.
Wow this works perfectly! Thank you 😊
No problem 😊
BOOM! You SMASHED IT!! Thanks Bro
Doesn't work. I tried this code and the carousel code and it's like the carousel code cancels the other one out and neither work. Do you have code that works for both?
You should only add one code. Difficult to be sure as it could depend on what else is on the page/build.
It does work for many others.
Hey my friend, i can use it for shopify store ? Add the snippet, for this error in pagespeed ?
Not sure about shopify
This issue always pissed me off... this is a great gift 4 me! Thanks :D
Efing gold. Thanks for this.
can i add this code in custom CSS for my Squarespace website .. if not then can you tellme how i will solve this issue in my square space website
I don't use SS websites, so unless I am commissioned to inspect, then I would advise on using ChatGPT.
i added a snippet but when i do the page speed insights it still has the error of Image elements do not have explicit width and height pls help
Which element? Carousel? BG image?
@@websquadron yes i have carousel in my home page which has multiple pics sliding together. Your code works but the problem is when i run the carousel is being remove from the page
Interesting that I had this code snippet, yet pagespeed still says I have the problem?
This is one of the most peculiar page speed issues - as it can occur for SVGs as well.
Hi, I still receive Image elements do not have explicit width and height when I insert elementors image carousel to site. :/
Did you use the refined code?
It’s a tricky one to get on top of.
Yes, I did. But I still receive this notice in pagespeed insights. @@websquadron
Nice! But... are you able to do this without adding an extra plugin?
There are many ways to tackle this but they often don’t work consistently. It’s a bit like webfonts not loaded when you’ve custom loaded them. This is the most pain free way
Simply place the code inside your child-theme > function.php file.
@@AwaisKhokhar02 Yup, but I prefer to use Code Snippets, plus if the video is watched by Non-Devs I would worry (a lot) when they edit the phps :)
@@websquadron true. 👍
Hi, it seems like the code link is not working.
The link is there?
websquadron.co.uk/fix-explicit-image-width-and-height/
Hello currently working on my marketing masters we are in our SEO section and this error has been driving me nuts on page insights I added the code in snippets but its still popping up
Are you also running other Snippets or optimisation tools?
@@websquadron we were using the autooptimize plugin and with both it on and off with the code the error continues to show up
Tried this and it didn't make the "image elements do not have explicit width and height" item go away. :/ Must be something else.
Are the images in a carousel or slider?
@@websquadron They're in both. I used a lot of different elements and sections on my main page.
@@websquadron what is the solution if the images are in a carousel or slider?
You are amazing! Thank you!
Where can I find the snippet? the link does not work
Use this link:
websquadron.co.uk/fix-explicit-image-width-and-height/
@@websquadron Thanks!!
Brilliant tip.
it fixed the problem, but the logo slider I copied from your other videos is gone.
It can affect sliders and carousels.
Seems not to work for mobile.
Also not for svg elements.
Am I missing something?
Works for me but will depend on what else is on the site. Are they carousels?
Im still getting image elements do not have explicit width and height in my insights speeds after have this snippet on for couple days, help pleaseeee
Can you share your URL?
@@websquadron am i tripping out or you must be deleting the comment as you have received the url, i typed it twice thinking im blocked from commenting or something haha 🫠
@@abbthedab1831 For some reason it's not showing.... email me the link: info@websquadron.co.uk
@@websquadron all send. Thank you
Thanks
Thanks a lot.
Thank you.
I cant believe this realy worked
I used this and all my images on the site disappeared help
Deactivate the snippet. Did it affect all or just carousel images.
@@websquadron I rolled back to the previous backup and scared to try it again lol
@@websquadron All, Even some of the text dissapeared.
bro where to add this code
Code Snippets.
functions.php
I tried this and some of my images disappeared, why is that?
Not sure as I haven’t had that problem on many sites (as have others). Have you got any other image optimisation tools active?
@@websquadron the only image optimisation tool i have active is the SiteGround Optimizer - Media section, would this have an effect?
As always very useful
How about blogger?
Hmm?
All my images disappeared?
Deactivate the snippet then. Could be due to a carousel? We have alternate code for that.
@@websquadron Could you share the link?
@@davidokon2988 learn.websquadron.co.uk/wordpress-page-speed/
I resolved it and it ok
Not worked
It does work for many so where did it not work
兄弟,你太伟大了,你知道吗!!! 爱死你
Translated to be: "Brother, you are so great, do you know that!!! I love you."
Many thanks :)
aAMazZinG..
I tried this and I must have a server config issue
Warning: getimagesize(nynv1on4lfcnt1wbdk4verci7ffvgz3cnr5wk9gnfk.jpg): failed to open stream: HTTP request failed! HTTP/1.1 403 Forbidden in /home/site/public_html/wp-content/plugins/code-snippets/php/snippet-ops.php(505) : eval()'d code on line 22
Yikes!
I've not had anything like that.
Roll-back or remove that snippet.
Seems to be working fine for me and many others (I've loaded this snippet onto 8 sites so far).