0

i am developing a website and i am pretty new to all of this so please forgive me if i make any mistakes , i just ran my webpage through google pagespeed and it says that i need to optimise my images by Properly formatting and compressing them but i am already compressing my images before upload to save bandwith, so the real trouble i am having is serving a scaled image size based on the screen size of the visiotrs device. i am guessing that my thumbnails are showing the full image size (but just smaller so it fits with the screen size) and i dont want this to happen, do you have any suggestions / solutions for me ?

                                    <?php if (  (function_exists('has_post_thumbnail')) && (has_post_thumbnail())  ) { ?>

                                        <a href="<?php the_permalink() ?>" rel="bookmark"title="<?php the_title(); ?>"><?php the_post_thumbnail('post-thumb'); ?></a>

                                    <?php } ?>

                                </div><!--blog-layout2-img-->
4
  • It really depends on your template code, and how you're fetching the thumbnails from the database. It's possible you're actually pulling the full-size thumbnail.
    – rnevius
    Mar 9, 2015 at 13:11
  • Yes I am pulling the full size thumbnail however what I am trying to achieve is the fact that the thumbnail displays the full image , but the image is at a lower resolution so it saves bandwith , thank you for the swift response!
    – amx128
    Mar 9, 2015 at 13:15
  • Can you show how you're calling the thumbnail in your php template?
    – rnevius
    Mar 9, 2015 at 13:26
  • i have added the code from the main index template (index.php) in the original question above which is the homepage of the website, hopefully this helps? again i do apologize if i seem like a total rookie but i guess everybody starts somewhere !
    – amx128
    Mar 9, 2015 at 13:34

1 Answer 1

0

Well, actually what you are doing is a good way or possibly the best way to go for thumbnail integration. You can define the thumbnail size in the configuration section of your site, as you have probably already noticed. You can maybe set them smaller, as they are only thumbnail images.

If you should have changed the thumbnail size already, you should regenerate the thumbnails, as WordPress won´t do that, if the old ones still exist. The easiest way to do so is to use the Regenerate Thumbnails plugin which can do this to all your files automatically.

On the other hand, I like to use the EWWW Image Optimizer in my sites. This often shrinks the files a good piece automatically after uploading and Google is so far very happy with that.

9
  • thank you very much for the suggestions, just used both plugins and regenerated all thumbnails from scratch again and deleted caches and it google still says ''Optimize images Properly formatting and compressing images can save many bytes of data. Optimize the following images to reduce their size by 980.5KiB (82% reduction)'' i think that my theme is just pulling the original image thats uploaded then just leaving the browser to shrink the image down which costs time instead of creating a smaller duplicate image that can be served on smaller devices much more quicker
    – amx128
    Mar 9, 2015 at 13:55
  • Well, this would not be how WordPress or good themes should work. Could you copy and paste one of the thumbnail URLs here? Thumbnails normally have the size added to their filename, so if your images don´t have that, they probably aren´t thumbnails. Example: http://www.mysite.de/wp-content/uploads/2015/03/whateveryouwant-430x320.jpg (Note the 430x320 at the end)
    – flomei
    Mar 9, 2015 at 14:09
  • itismad.com/wp-content/uploads/2015/03/…. as you can see there is no image dimensions specified in the url
    – amx128
    Mar 9, 2015 at 14:24
  • I see. This is what the theme uses as a thumbnail? No wonder Google is not really happy with that. Are you sure that the code posted above is really used here? What is your thumbnail size set to?
    – flomei
    Mar 9, 2015 at 14:26
  • In the php, I set the thumbnail dimensions to auto so it displays the whole image instead of a cropped image as it is a content based website , could that be the problem why?
    – amx128
    Mar 9, 2015 at 14:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.