Really flexible and easy-to-use PHP class to work with images using the GD Library
Included Layer Effects.
Version 2.0.8.1 - 2014-5-6
- Updated includeds to allow load files if the main class is not already defined (like autoloading except), if you still wish to auto load (inorder to add custom load files) then just comment out
if (!class_exists('classname')) {
require_once(pathandfilename.php');
}
// example :
if (!class_exists('ImageWorkshopLayer')) { // auto loads if not already loaded.
require_once(__DIR__.'/Core/ImageWorkshopLayer.php');
}Version 2.0.8 - 2014-5-6
- removed Layer Effect class and merged back into main Layer Class(Working to resolve issues with extracted effects).
- add new enableAlpha method: the first argument turns on alpha blending for graphic manipuation, the second turns on alpha blending when saving image (this prevents the black background).
- add new setTransparentColor method: the first three arguments are RBG values of the color the forth is the tolerance so colors +/- the tolerance will also be made transparent the fifth argument is optional and it locks the tolerance so that only color with the same hue and saturation as the base color will be altered, optional feather by tolerance true/false is the sixth argument. this cause the degree of transpanancy to Decay futher the color differs from the base color.
$layer->enabeAlpha($blend,$save);
example:
$layer->enabeAlpha(true,true);
$layer->setTransparentColor($r,$g,$b,$tolerance,$Lock,$feather);
example:
$layer->setTransparentColor(0,0,0,7,false,true);Version 2.0.7 - 2014-3-6
-
Move Layer effect into there own class, allowing you to use your own effects libaries.
-
Added Extended_Effects method which request Effect name, EffectsLib object , and if it should apply recursively.
Version 2.0.7 - 2014-2-5
- Forked
- Added Layer Effect:
- applyFilter
- applyImageConvolution
- toGreyscale
- applyAlphaMask
- splitChannels
- getChannel
- mergeChannels
Version 2.0.5 - 2013-11-12
- Implementing interlace mode (http://php.net/manual/en/function.imageinterlace.php) on save() method to display progessive JPEG image
$interlace = true; // set true to enable interlace, false by default
$layer->save($dirPath, $filename, $createFolders, $backgroundColor, $imageQuality, $interlace);Thanks @dripolles (https://github.com/dripolles) & @johnhunt (https://github.com/johnhunt)
Version 2.0.4 - 2013-09-11
- Fix a major bug when resizing both sides AND conserving proportion : layer stack problem (current layer has a new nested level in its stack, not expected), and translations with positionX and positionY are wrong. Fixed. (Initial problem : Sybio#14)
- Add a parameter to clearStack() method
Version 2.0.2 - 2013-06-14
- Fix a new bug : when resizing or cropping, small images can have 0 pixel of width or height (because of round), which is impossible and script crashes. Now width and height are 1 pixel minimum.
Note:
$layer->resizeInPixel(null, 0 /* or negative number */, null);It will generate a 1 pixel height image, not 0.
Version 2.0.1 - 2013-06-03
- Fix an opacity bug : pure black color (#000000) always displayed fully transparent (from 0 to 99% opacity). Bug fixed ! (no known bug anymore)
- Add some Exceptions to help debugging
Version 2.0.0 - 2012-11-21
New version of ImageWorkshop ! The library is now divided in 3 main classes for cleaned code:
- ImageWorkshopLayer: the class which represents a layer, that you manipulate
- ImageWorkshop: a factory that is used to generate layers
- ImageWorkshopLib: a class containing some tools (for calculations, etc...), used by both classes
Technically, only the initialization change compared with the 1.3.x versions, check the documentation: http://phpimageworkshop.com/documentation.html#chapter-initialization-of-a-layer
Here an example, before and now:
// before
$layer = new ImageWorkshop(array(
'imageFromPath' => '/path/to/images/picture.jpg',
)); // now
$layer = ImageWorkshop::initFromPath('/path/to/images/picture.jpg');And also the installation of the class: http://phpimageworkshop.com/installation.html
The documentation has been updated, you can now check the documentation of each version since 1.3.3: (Ex: http://phpimageworkshop.com/doc/9/initialize-from-an-image-file.html?version=2.0.0, http://phpimageworkshop.com/doc/9/initialize-from-an-image-file.html?version=1.3.3)
The class is designed for PHP 5.3+, but it can work with older PHP versions... Check how to install the class here: http://phpimageworkshop.com/installation.html
- Learn how to use the class in 5 minutes: http://phpimageworkshop.com/quickstart.html
- The complete documentation: http://phpimageworkshop.com/documentation.html
- Usefull tutorials: http://phpimageworkshop.com/tutorials.html
What's new in the doc' ?
- Installation guide: http://phpimageworkshop.com/installation.html
- Adding the flip documentation: http://phpimageworkshop.com/doc/25/flip-vertical-horizontal-mirror.html
- Adding the opacity documentation which was omitted: http://phpimageworkshop.com/doc/24/opacity-transparency.html
- Tutorial "Manage animated GIF with ImageWorkshop (and GiFFrameExtractor & GifCreator)": http://phpimageworkshop.com/tutorial/5/manage-animated-gif-with-imageworkshop.html
- Adding a method to add easily borders to a layer (external, inside and middle border)
- Check given hexa' color and remove # if exists.
