Suboptimal image resizing problem (2 posts)

  1. mondalaci
    Posted 3 years ago #

    Hi Mike,

    I've just used Google PageSpeed Insights for my site which revealed numerous warnings like this:

    https://lh5.googleusercontent.com/-MvaubvtLHmM/UAySJWkLYbI/AAAAAAAAAEo/I2E_2LzTV44/IMG_0879.JPG?imgmax=640 is resized in HTML or CSS from 640x480 to 606x456. Serving a scaled image could save 4.9KiB (11% reduction).

    As it turns out in my posts Shashin codes like [shashin type="photo" id="31" size="large"] generated HTML like <img src="https://lh5.googleusercontent.com/-MvaubvtLHmM/UAySJWkLYbI/AAAAAAAAAEo/I2E_2LzTV44/IMG_0879.JPG?imgmax=640" alt="Wifi switchover fail" width="600" height="450" class="shashinThumbnailImage" id="shashinThumbnailImage_1" />

    I could easily notice that these images could be resized on the server side by providing the relevant imgmax parameter like https://lh5.googleusercontent.com/-MvaubvtLHmM/UAySJWkLYbI/AAAAAAAAAEo/I2E_2LzTV44/IMG_0879.JPG?imgmax=600

    This would conserve bandwith as much as possible.

    Is there any reason why Shashin doesn't use the best value for this parameter in such cases?



  2. Mike Toppa
    Plugin Author

    Posted 3 years ago #

    Thanks for pointing this out. When I wrote the code for handling sizing, Picasa only allowed you to request photos from a limited set of sizes. For example, 600 was not a valid option - you had to choose either 576 or 640. Now it looks like you can get any size you want from Picasa. When I added support for Twitpic and Youtube, I wanted to provide a consistent user experience with the sizes (as Twitpic also had a limited set of sizes, which were different from Picasa's). So Shashin picks the next largest valid size from whatever size you specify, and then relies on browser scaling.

    I've added this to the issues list: https://github.com/toppa/Shashin/issues/37

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Shashin
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.