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

КОМЕНТАРІ • 89

  • @websquadron
    @websquadron  Рік тому +5

    This is the Snippet to use: websquadron.co.uk/fix-explicit-image-width-and-height/

    • @ecoverdevaletingservice
      @ecoverdevaletingservice Рік тому +5

      bro, the snippet doesn't work, speedsights still shows up the
      Image elements do not have explicit width and height, please advice

    • @davidokon2988
      @davidokon2988 4 місяці тому

      Same thing Images not showing

    • @websquadron
      @websquadron  4 місяці тому

      @@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.

  • @arianhernandez4943
    @arianhernandez4943 Рік тому +1

    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

  • @DCMARTIN
    @DCMARTIN Рік тому

    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!

  • @phkoon
    @phkoon 6 місяців тому +1

    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

    • @websquadron
      @websquadron  6 місяців тому +1

      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.

    • @phkoon
      @phkoon 6 місяців тому

      ​@@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

  • @meartscanal
    @meartscanal 5 місяців тому

    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. :/

    • @websquadron
      @websquadron  5 місяців тому

      Did you have a carousel or slider on the screen?

    • @meartscanal
      @meartscanal 5 місяців тому

      @@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.

  • @Mara-mp8ld
    @Mara-mp8ld 10 місяців тому +1

    Wow this works perfectly! Thank you 😊

  • @gluedtoyoutube4
    @gluedtoyoutube4 6 місяців тому

    BOOM! You SMASHED IT!! Thanks Bro

  • @YolandaRidley
    @YolandaRidley 3 місяці тому

    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?

    • @websquadron
      @websquadron  3 місяці тому

      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.

  • @enerycouplemxfr
    @enerycouplemxfr Рік тому

    Hey my friend, i can use it for shopify store ? Add the snippet, for this error in pagespeed ?

  • @sergiurus4115
    @sergiurus4115 Рік тому +4

    This issue always pissed me off... this is a great gift 4 me! Thanks :D

  • @VRuler
    @VRuler Рік тому +1

    Efing gold. Thanks for this.

  • @fatimaparacha8254
    @fatimaparacha8254 9 місяців тому

    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

    • @websquadron
      @websquadron  9 місяців тому

      I don't use SS websites, so unless I am commissioned to inspect, then I would advise on using ChatGPT.

  • @mackynyxz
    @mackynyxz 7 місяців тому

    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

    • @websquadron
      @websquadron  7 місяців тому

      Which element? Carousel? BG image?

    • @mackynyxz
      @mackynyxz 7 місяців тому

      @@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

  • @oracoweb
    @oracoweb Рік тому +1

    Interesting that I had this code snippet, yet pagespeed still says I have the problem?

    • @websquadron
      @websquadron  Рік тому

      This is one of the most peculiar page speed issues - as it can occur for SVGs as well.

  • @m-webdesign6495
    @m-webdesign6495 Рік тому

    Hi, I still receive Image elements do not have explicit width and height when I insert elementors image carousel to site. :/

    • @websquadron
      @websquadron  Рік тому

      Did you use the refined code?
      It’s a tricky one to get on top of.

    • @m-webdesign6495
      @m-webdesign6495 Рік тому

      Yes, I did. But I still receive this notice in pagespeed insights. @@websquadron

  • @ThatGuyBarrold
    @ThatGuyBarrold Рік тому

    Nice! But... are you able to do this without adding an extra plugin?

    • @websquadron
      @websquadron  Рік тому +1

      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

    • @AwaisKhokhar02
      @AwaisKhokhar02 Рік тому +3

      Simply place the code inside your child-theme > function.php file.

    • @websquadron
      @websquadron  Рік тому +3

      @@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 :)

    • @AwaisKhokhar02
      @AwaisKhokhar02 Рік тому

      @@websquadron true. 👍

  • @mr.r1527
    @mr.r1527 11 місяців тому

    Hi, it seems like the code link is not working.

    • @websquadron
      @websquadron  11 місяців тому

      The link is there?
      websquadron.co.uk/fix-explicit-image-width-and-height/

  • @regulush0743
    @regulush0743 Рік тому

    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

    • @websquadron
      @websquadron  Рік тому

      Are you also running other Snippets or optimisation tools?

    • @regulush0743
      @regulush0743 Рік тому

      @@websquadron we were using the autooptimize plugin and with both it on and off with the code the error continues to show up

  • @milo_thatch_incarnate
    @milo_thatch_incarnate Рік тому +1

    Tried this and it didn't make the "image elements do not have explicit width and height" item go away. :/ Must be something else.

    • @websquadron
      @websquadron  Рік тому +1

      Are the images in a carousel or slider?

    • @milo_thatch_incarnate
      @milo_thatch_incarnate Рік тому

      @@websquadron They're in both. I used a lot of different elements and sections on my main page.

    • @d.d.4423
      @d.d.4423 Рік тому +1

      @@websquadron what is the solution if the images are in a carousel or slider?

  • @MartoneDaniels
    @MartoneDaniels Рік тому

    You are amazing! Thank you!

  • @giuseppeiacono2649
    @giuseppeiacono2649 Рік тому

    Where can I find the snippet? the link does not work

    • @websquadron
      @websquadron  Рік тому +1

      Use this link:
      websquadron.co.uk/fix-explicit-image-width-and-height/

    • @giuseppeiacono2649
      @giuseppeiacono2649 Рік тому

      @@websquadron Thanks!!

  • @buntuscainte4987
    @buntuscainte4987 Рік тому +1

    Brilliant tip.

  • @workwithdarvin
    @workwithdarvin 10 місяців тому

    it fixed the problem, but the logo slider I copied from your other videos is gone.

    • @websquadron
      @websquadron  10 місяців тому +1

      It can affect sliders and carousels.

  • @ni-wo
    @ni-wo Рік тому

    Seems not to work for mobile.
    Also not for svg elements.
    Am I missing something?

    • @websquadron
      @websquadron  Рік тому

      Works for me but will depend on what else is on the site. Are they carousels?

  • @abbthedab1831
    @abbthedab1831 Рік тому

    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

    • @websquadron
      @websquadron  Рік тому

      Can you share your URL?

    • @abbthedab1831
      @abbthedab1831 Рік тому

      @@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 🫠

    • @websquadron
      @websquadron  Рік тому

      @@abbthedab1831 For some reason it's not showing.... email me the link: info@websquadron.co.uk

    • @abbthedab1831
      @abbthedab1831 Рік тому

      @@websquadron all send. Thank you

  • @buntuscainte4987
    @buntuscainte4987 Рік тому +1

    Thanks

  • @this_was
    @this_was Рік тому

    Thanks a lot.

  • @GksBijoy-md2fc
    @GksBijoy-md2fc Рік тому

    Thank you.

  • @daneduardosoroka8855
    @daneduardosoroka8855 10 місяців тому

    I cant believe this realy worked

  • @AbuBakrImtiaz
    @AbuBakrImtiaz 4 місяці тому

    I used this and all my images on the site disappeared help

    • @websquadron
      @websquadron  4 місяці тому

      Deactivate the snippet. Did it affect all or just carousel images.

    • @AbuBakrImtiaz
      @AbuBakrImtiaz 4 місяці тому

      @@websquadron I rolled back to the previous backup and scared to try it again lol

    • @AbuBakrImtiaz
      @AbuBakrImtiaz 4 місяці тому

      @@websquadron All, Even some of the text dissapeared.

  • @jafrytrends
    @jafrytrends Рік тому

    bro where to add this code

  • @jphilips7
    @jphilips7 Рік тому

    I tried this and some of my images disappeared, why is that?

    • @websquadron
      @websquadron  Рік тому

      Not sure as I haven’t had that problem on many sites (as have others). Have you got any other image optimisation tools active?

    • @jphilips7
      @jphilips7 Рік тому

      @@websquadron the only image optimisation tool i have active is the SiteGround Optimizer - Media section, would this have an effect?

  • @fabiank8770
    @fabiank8770 Рік тому +1

    As always very useful

  • @MobiZony-rq7se
    @MobiZony-rq7se Рік тому

    How about blogger?

  • @davidokon2988
    @davidokon2988 4 місяці тому

    All my images disappeared?

    • @websquadron
      @websquadron  4 місяці тому

      Deactivate the snippet then. Could be due to a carousel? We have alternate code for that.

    • @davidokon2988
      @davidokon2988 4 місяці тому

      @@websquadron Could you share the link?

    • @websquadron
      @websquadron  4 місяці тому

      @@davidokon2988 learn.websquadron.co.uk/wordpress-page-speed/

    • @davidokon2988
      @davidokon2988 4 місяці тому

      I resolved it and it ok

  • @prodevrahmat8733
    @prodevrahmat8733 10 місяців тому

    Not worked

    • @websquadron
      @websquadron  10 місяців тому

      It does work for many so where did it not work

  • @dannymichael9793
    @dannymichael9793 Рік тому

    兄弟,你太伟大了,你知道吗!!! 爱死你

    • @websquadron
      @websquadron  Рік тому +1

      Translated to be: "Brother, you are so great, do you know that!!! I love you."
      Many thanks :)

  • @peacebuilder3164
    @peacebuilder3164 4 місяці тому +1

    aAMazZinG..

  • @jasonrhl
    @jasonrhl Рік тому

    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

    • @websquadron
      @websquadron  Рік тому +2

      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).