Optimizing Images: Improving Your Sites Performance

Now even more important than ever, is having a fast loading web site. Google now takes this into account when ranking pages (Google Blog). As well as potentially better position on Google is the possibility of keeping more users on your site (reducing the bounce rate) and if you’re an ecommerce site, increasing the conversion rate.

Decreasing The Size of Your Web Pages

A really easy way to speed up a website is to decrease the amount of data that needs to be downloaded in order to view a certain page. Put another way, decrease the total file size of a web page (this includes all the images, css, javascript, and any other media such as Flash).

The rest of this post is going to focus solely on reducing the size of your images, I will hopefully cover other topics relating to improving the performance of a website in the next few weeks.

Making Your Images Really Small

As most web sites today rely on using a large number of images, decreasing the file size of these can instantly decrease the size of a web page and improve its performance. When I say decreasing the file size I mean decreasing it without reducing the quality of the image (i.e. lossless compression).

A couple of tools for optimizing images are:

  • Pngcrush
  • Yahoo! Smush.it

Continue reading

Comparing preg_replace and str_ireplace (Rude Word(s) Filter)

Filtering users input is unfortunately something that needs to be done these days. Possibly even more so when the content is coming from another website/service (such as twitter or facebook).  Swearing/rude words is quite a serious area, as you really don’t want to offend any visitors to your site by displaying a live thread showing comment or a ‘tweet’ or similar containing offensive langauge (tends to go down badly). So on this very note I set out today to add a live twitter feed to my current project (www.wsaf.co.uk), but decided once I had pulled the data from twitter I should probably remove any swearing before displaying it on the site!

As the site is written in php funnily enough this was also going to be. As I like to make my code as fast a possible I decided I would test the speed to different functions that could be used for this purpose:


Continue reading