YSlow’s Smush.it Adds File Uploader

by jim on March 24th, 2010

Almost all of the images on Bargaineering are stored in a local directory. My experience with Flickr has taught me that it’s all too uncommon for a photographer to remove a photo and have things look silly on my site. To Flickr’s credit, they replace it with a nice “This photo is no longer available” image, rather than an ugly broken 404 image. So in response to this, I search for CC-licensed images and I download them locally. I put them through Yahoo! Yslow’s Smush.it and upload them to the site.

Storing images locally is a trade off. You get that control but there’s increased server load, the risk that someone hotlinks an image thus creating more load (though you can stop this easily), but you get one less lookup. I think it’s worth it.

I didn’t always do this and my directory had tons of files that were un-smushed, so I was pumped when the recent update to Smush.it included an uploader tool. This lets me download all of my image files, smush them in batches, rewrite some filenames, and upload them back to my server.

The “rewrite some filenames” piece is the result of Smush.it converting GIFs to PNGs, PNGs are better because they’re more efficient, and you can do that by running this file renaming .JS script file in the directory.

I was able to trip a good 20% off the size of my image directory using Smush.it for about thirty minutes.

RSS Subscribe Like this article? Get all the latest articles sent to your email for free every day. Just click "Subscribe" and enter your email. Your email will only be used for this daily subscription and you can unsubscribe anytime.

2 Responses to “YSlow’s Smush.it Adds File Uploader”

  1. Peter Says:

    I think I’m going to be trying this, however, how do you deal with the problem of renamed images (.gif to .png) and their references in the database? For example, if you have an image on a post called “image.gif” that gets resaved as “image.png”, what do you do about the reference in that post to “image.gif”? Won’t the images all not show up then? Do you have a script that will fix those references or something?

  2. jim Says:

    I rewrite the PNGs so they have the .GIF extension – http://www.wangarific.com/rewrite-rename-filenames-using-javascript/

Leave a Reply