note 55974 added to function.imagefilter

From: Date: Fri, 19 Aug 2005 13:35:03 +0000
Subject: note 55974 added to function.imagefilter
Groups: php.notes 
Request: Send a blank email to php-notes+get-93900@lists.php.net to get a copy of this message
image blur for PHP<5: <? function myImageBlur($im,$distance=1) { // 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); // blur by merging with itself at different x/y offsets: for($i=1 ; $i<=$distance ; $i++) { ImageCopyMerge($temp_im, $im, 0, 0, 0, $i, $width, $height-$i, 70); ImageCopyMerge($im, $temp_im, 0, 0, $i, 0, $width-$i, $height, 70); ImageCopyMerge($temp_im, $im, 0, $i, 0, 0, $width, $height, 70); ImageCopyMerge($im, $temp_im, $i, 0, 0, 0, $width, $height, 70); } // remove temp image ImageDestroy($temp_im); return $im; } ?> MyImageBlue($im); will just fuzz the image, but using the optional $distance parameter, you blur by larger amounts It's not the fastest function you'll ever see, but I hope it helps. for more such wonders, check out http://www.puremango.co.uk ---- Manual Page -- http://www.php.net/manual/en/function.imagefilter.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+55974 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+55974&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+55974&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+55974&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+55974&report=yes&reason=useless Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+55974&report=yes&reason=non-english Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+55974&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+55974&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#93900) next »