PHP Image Resizing on the fly

Hey everyone!

For the life of me, I can’t remember if I mentioned this or not, but I started a new job! I’m a week and a half into it and really enjoying it. It’s a little different than what I was doing before. I was more Front End Developer. Now I’m much more Back End. Getting my hands dirty with OOP PHP and mySQL. It’s been really tough, but I am stepping up to the challenge. The company is very supportive and much (much) bigger. I’m surrounded with a bunch of other geeks (aka developers).

Annnnyhwoo, onto the subject of this post. Ever needed to just create some quick and dirty PHP that will resize images on the fly? No Photoshop or other image software required? Well I did. I didn’t want to have to go through and resize everything myself. I found a PHP script that is SUPER easy to use and creates cached images so you don’t have to screw up your own. It’s called TimThumb and you can find it in the Google Project Hosting here: https://code.google.com/p/timthumb/. There are a ton of different options. You can find it on the developer’s website. One note of warning: Don’t use it for WordPress. This script is only meant for quick and dirty. Apparently there’s a security flaw that can be exploited. Darn hackers. WordPress already comes with it’s own Regenerate Thumbnail script that is easy to use. I’ve also used it on this blog.

There’s another option that I have found if you want to stay away from TimThumb (I get it–I’m going to adapt my code to a new version when I get a chance) and it can be found on a blog of a developer who I look up to who is named David Walsh. This guy is pretty brilliant and posts a lot of different tips for PHP, jQuery, CSS, and MooTools. You can find his script for resizing images with PHP on his blog.

That’s all I got for now! 🙂 I hope to share more on things I’ve learned at the new job soon.

Have a great weekend!

Leave a Reply

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