note 90376 deleted from function.imagick-blurimage by danbrown
| From: | danbrown@php.net | Date: | Sun, 19 Apr 2009 02:49:09 +0000 |
| Subject: | note 90376 deleted from function.imagick-blurimage by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-153478@lists.php.net to get a copy of this message | ||
Note Submitter: puremango dot co dot uk at gmail dot com
----
A pure GD ImageBlur. More at http://www.puremango.co.uk
<?
function myImageBlur($im)
{
// w00t. my very own blur function
$width = imagesx($im);
$height = imagesy($im);
$temp_im = ImageCreateTrueColor($width,$height);
$bg = ImageColorAllocate($temp_im,150,150,150);
// preserves transparency if in orig image
ImageColorTransparent($temp_im,$bg);
// fill bg
ImageFill($temp_im,0,0,$bg);
// the higher, the more blurred (no impact on speed)
$distance = 1;
// blur by merging with itself at different x/y offsets:
ImageCopyMerge($temp_im, $im, 0, 0, 0, $distance, $width, $height-$distance, 70);
ImageCopyMerge($im, $temp_im, 0, 0, $distance, 0, $width-$distance, $height, 70);
ImageCopyMerge($temp_im, $im, 0, $distance, 0, 0, $width, $height, 70);
ImageCopyMerge($im, $temp_im, $distance, 0, 0, 0, $width, $height, 70);
// remove temp image
ImageDestroy($temp_im);
return $im;
}
?>