I’ve just released it. You can download it here. Optionally, you can use the 1.0-beta-2 svn tag.
This is the last release before RC1, which is coming soon (Q1 2009 expected). The main purpose for this release is stabilization, new unit tests, bug fixes, and some features. The online documentation is left behind (mostly still for beta 1), but no major API changes were made. The inline docs hold a more up-to-date documentation.
Magic dimensions
WideImage now supports an extended notation of dimensions for some operations (resize, crop, merge, …). The possible uses are:
- integer/float – literal value is taken for coordinate
- percent string – the coordinate in percent of the dimension
- center-relative coordinate – specify the coordinate relative to center, rather than absolute
Examples:
// crops a 50x40 rectangle, starting at 10, 20
$cropped = $img->crop(10, 20, 50, 40);
// crops a 50% (half of the width) x20 rectangle,
// starting at 0, 20% (20% of the height)
$cropped = $img->crop(0, '20%', '50%', 20);
// crops a 100x50 rectangle directly
// in the middle of the image (center-relative coordinates are used)
$cropped = $img->crop('c-50', 'c-25', 100, 50);
These “magic dimensions” will acquire a less silly name (smart coordinates) in RC1, and will be developed further.
Loading from files without extension/mime-type
Is now supported. That’s it
. I’ve decided to use imagecreatefromstring(file_get_contents($filename)), so now the image format is detected automatically. No more format or mime-type hinting is necessary. The other side-effect is that now WideImage suddenly supports all GD2-supported formats for reading. For writing, it’s still GIF, JPEG, PNG, GD, GD2. BMP is scheduled for RC1, but may end up in RC2.
Other stuff
- AutoCrop — See demos in the package for details.
- PS font support added
- Canvas magic supported: the Canvas object now supports all functions that start with “image”, and you don’t have to pass an image handle to it.
For example, to draw a red line:
// you had to do this:
imageline($image->getHandle(), 0, 0, 50, 50, $image->allocateColor(255, 0, 0));
// now you can do this:
$canvas = $image->getCanvas();
$canvas->line(0, 0, 50, 50, $image->allocateColor(255, 0, 0));
At first, it may not seem much, and maybe it isn’t. But at least I can say that Canvas supports custom drawing.
All in all, this is not a feature release. If you’re annoyed by bugs in beta1, or are looking forward to try AutoCrop, then upgrade, otherwise it’s not really necessary.