GTMetrix question

Howdy all,

I’ve spent a happy day optimising my website with GTMetrix and have improved its size and speed of loading a lot.

The only area in which my website is below average in performance is “Specify image dimensions”.

I don’t understand this as, for just one example, I have made the image the correct size and even so have specified tie image size in Blocs. See images.

Can anybody advise me please?

This is the advice as shown on the GTMetrix site:

This is the ‘help’ as shown on the GTMetrix site:

This is Blocs showing the size specified:

Screenshot 2020-05-10 at 15.00.19

@Ian Hmmn, it looks like the image size in blocs is not being exported as an inline stye attribute. I’m not sure if this is a bug or intended. The last thing you should have to do is create a class for each image. Perhaps it is a bug? I just tested it and no matter what you put in the width and height, it’s not output in the HTML.

For example you have on you main page (classes removed for brevity):
<img src="img/Ian-Poulson-paws.png" alt="Ian_Poulson-paws">

Perhaps it should be outputting:
<img src="img/Ian-Poulson-paws.png" alt="Ian_Poulson-paws" style="width:40px;height:40px;>

But I’m not sure if there is a setting in Blocs somewhere.

cc: @Norm

Thanks @Hypnoman, I wonder if @Norm knows the answer?

Also, messing around with GTMetrix further, I was planning on asking @Norm whether Blocs has a means of addressing the issues arrowed? Other than those, my website seems to be performing well.

For expire headers, you can add this to the bottom of you .htaccess
in the root of your domain:

<IfModule mod_expires.c>
  ExpiresActive On

  # Images
  ExpiresByType image/jpeg "access plus 1 year"
  ExpiresByType image/gif "access plus 1 year"
  ExpiresByType image/png "access plus 1 year"
  ExpiresByType image/webp "access plus 1 year"
  ExpiresByType image/svg+xml "access plus 1 year"
  ExpiresByType image/x-icon "access plus 1 year"

  # Video
  ExpiresByType video/mp4 "access plus 1 year"
  ExpiresByType video/mpeg "access plus 1 year"

  # CSS, JavaScript
  ExpiresByType text/css "access plus 1 month"
  ExpiresByType text/javascript "access plus 1 month"
  ExpiresByType application/javascript "access plus 1 month"

  # Others
  ExpiresByType application/pdf "access plus 1 month"
  ExpiresByType application/x-shockwave-flash "access plus 1 month"
</IfModule>

Literally just copy and paste?

Yup - that will improve your score a lot

And you can optimize the images by clicking on the optimised images link then replacing the images in Blocs with the optimised version

You’re right… a LOT!!!

Thanks so much!

1 Like

Re the optimised images, I’ve spent most of the day doing that, it keeps asking me to do some all over again.

(All the images with “min” in their names have already been done!)

But I shall, it’s reduced my website size by approx 25% already.

1 Like