function imagecache_gd_imagefilter in ImageCache Actions 6
Same name and namespace in other branches
- 5.3 imagecache_coloractions.module \imagecache_gd_imagefilter()
- 5.2 imagecache_coloractions.module \imagecache_gd_imagefilter()
Attempt to run imagefilter, which may or may not be included with your gdtoolkit. If it isn't, a local script is used to emulate the simpler of its functions.
1 call to imagecache_gd_imagefilter()
- imagecache_imagefilter in ./
imagecache_coloractions.module - Stub for the image toolkit.
File
- ./
imagecache_coloractions.module, line 228 - Additional actions for imagecache processing.
Code
function imagecache_gd_imagefilter($image, $filter, $arg1, $arg2, $arg3) {
// some distros that allegedly include PHP5 GD2 are faulty.
// thankyou http://www.weberdev.com/get_example-4601.html
if (!function_exists('imagefilter')) {
include_once 'imagefilter.inc';
}
$info = $image->info;
if (!$info) {
return FALSE;
}
#dpm("run imagefilter imagefilter($image->resource, $filter, $arg1, $arg2, $arg3)");
imagesavealpha($image->resource, TRUE);
# This is a bit silly really, php internals complain if it's given TOO MANY args!
# Should refactor this and not be so lazy.
if (!is_null($arg2) && !is_null($arg3)) {
return imagefilter($image->resource, $filter, $arg1, $arg2, $arg3);
}
else {
if (!is_null($arg2) && is_null($arg3)) {
return imagefilter($image->resource, $filter, $arg1, $arg2);
}
else {
if (is_null($arg2) && is_null($arg3)) {
return imagefilter($image->resource, $filter, $arg1);
}
}
}
}