Google it! / Yahoo it! / Bing it! / Ask it!

I’m helping a friend build a CMS for a site and I needed some automatic image resizing. The only possibility was GD so I decided to use it. There are many tutorials out there teaching you how to do it, but I wrote my own function from several GD functions available and some php.net help.

Here is the function: [download]

And here is the caller. Remember to set the path right, both in the function and in the caller.

<?php echo '<a href="image.jpg"><img src="thumbnail.inc.php?img=image.jpg" alt="" /></a>'; ?>

That’s all.

One Response to PHP GD Thumbnails

  • I was looking something like this. I going to give it a try but I don’t know if I will be able to implement it by myself.
    Thank you.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>