PHP compress image size on the fly (Timthumb script – Validate XHTML)

October 16th, 2008

ADVERTISEMENTS

Most of you might already heard of Timthumb php script to compress (re-size) images on fly. If you have not heard of it then please view this post from the author – Darren Hoyt.

This entry will not show you how to use it as you can read the full documentation and demo on the author’s blog.  I recently used Timthumb php script for quite few projects (TE,  Mary Chocolatier ..) and it actually save a lot of bandwidth and development time. However, all of the pages which use Timthumb script does not validate XHTML and generated many errors and warning messages.

To get the most out of TimThumb script and improve your pages to pass W3C XHTML validation check, please follow this below edit:

Original code:
<img src=”/scripts/timthumb.php?src=/images/whatever.jpg&h=150&w=150&;zc=1″ alt=”" />

Change it to:

<img src=”/scripts/timthumb.php?src=/images/whatever.jpg&amp;h=150&amp;w=150&amp;zc=1″ alt=”" />
Now come back to W3C Markup Validation Service to see how your page been approved.

Random Posts

Categories: PHP, Web development | Tags: , , , ,

2 Comments

  1. Trey

    Thanks a lot for this small fix :D

  2. Jepser

    Man! awsome thanks :)

Leave a comment