released: Oct 26th, 2009
uses: PHP 5+, GD, iMagick
PHP + GD + ImageMagick + You = Easy Image Manipulation
introducing PHP Thumb. grow beautiful apps.
Welcome to the new home of my PHP image manipulation library, now called “PHP Thumb”. It’s been a long time coming, but the third major release is complete, and I’m really excited about it. If you’re a new user of this library, I hope you find it useful. If you’re a returning user, I’m sure you’ll be excited with all the changes that have been made.
PHP Thumb is a light-weight image manipulation library aimed at thumbnail generation. It features the ability to resize by width, height, and percentage, create custom crops, or square crops from the center, and rotate the image. You can also easily add custom functionality to the library through plugins. It also features the ability to perform multiple manipulations per instance (also known as chaining), without the need to save and re-initialize the class with every manipulation.
You don’t really need much to get started, just PHP 5 and GD 2.0+ In the past there was also a PHP 4 version of the class, but I’ve decided not to support PHP 4 anymore for many reasons.
Ready to get started? Well then, download the latest release! Make sure you also check out these useful links:
I’ve mostly been doing bug fixes and augmenting current functionality based on user suggestions in the forums, but the big news is that I’ve moved the project to GitHub. Check it (and my other stuff if you’re bored) out at: http://github.com/masterexploder/PHPThumb.
I’ve done this because it will not only cut down on the amount of spam that I got in the old Trac-based ticketing system, but it will be easier for other people to contribute to the library. That being said, if you want to contribute, get busy and fork the project!
Don’t have time to read the docs? Want to see how easy it is to get started with the PHP Thumb library? Right, check this out:
<?php require_once '/path/to/ThumbLib.inc.php'; $thumb = PhpThumbFactory::create('test.jpg'); $thumb->resize(100, 100); $thumb->show(); ?>
But, it gets even cleaner… let’s change the above code to save, and we’ll also use function chaining:
<?php require_once '/path/to/ThumbLib.inc.php'; $thumb = PhpThumbFactory::create('test.jpg'); $thumb->resize(100, 100)->save('/path/to/new_thumb.jpg'); ?>
Of course, it’s highly recommended that you read the docs as there’s a lot more to the library (and some important gotchas)… but, it’s really that easy!
Plugins are one of the best new features of the library. It’s always been my goal to keep this thing as light-weight as possible, but there are a lot of features out there that people would like to see. Well, plugins solve that problem. Now, you can either add official plugins to the library, or develop your own to add the features and functionality you’re looking for… without having to hack up the actual core code!
I haven’t really figured out how I want to deal with user-contributed plugins just yet, so for now, if you’ve got a plugin you’d like to have considered for inclusion in the distributed package, get in touch with me either via a ticket or in the forums. Eventually, I hope to have a plugins directory of sorts, but for now you can also always post your plugins in the forums.
Documentation for included plugins can be found on the docs site, as well as the documentation for actual plugin development. You can also take a look at the included plugins to get you started as well. As this is a brand-spanking new feature, it’s quite likely that there will be several changes based on YOUR feedback. If you’ve got any feedback whatsoever, please don’t hesitate to share it… seriously. If you think the plugin architecture sucks, I want to know about it, and why (I don’t mind constructive criticism, but don’t expect me to dignify unqualified complaints).
Check back here from time to time for updates as things develop and progress.
I’ve tried to vastly improve the documentation, as well as the community as well. Rather than trolling through hundreds of comments, we’ve now got a forum, and I’ve also migrated to using GitHub ticketing.
Anyway, here’s a list of important links for docs and help:
A couple of notes. Please don’t abuse the bug tracking system. If you can’t figure something out, that’s not a bug… ask questions in the forums. I don’t have a lot of time, but I’m glad to help anyone out as best I can… however, any improperly filed bugs will be closed. Also, try not to submit anonymous bugs… I’m less likely to solve problems if I can’t communicate with the person who reported the issue in the first place!
Other than that, feel free to use any of the resources above to get in touch with me and get help… I’m always happy to help when I can, and so is the community