<?PHPclassimage_blur{function Gaussian_blur ($srcImg, $savepath=NULL, $savename =NULL, $blurFactor =3) {$gdImageResource=$ This-Image_create_from_ext ($SRCIMG); $SRCIMGOBJ=$ This-Blur ($gdImageResource, $blurFactor); $temp=PathInfo ($SRCIMG); $name= $temp ['basename']; $path= $temp ['dirname']; $exte= $temp ['extension']; $savename= $savename?$savename: $name; $savepath= $savepath?$savepath: $path; $savefile= $savepath.'/'. $savename; $srcinfo=@getimagesize ($SRCIMG); Switch($srcinfo [2]) { Case 1: Imagegif ($SRCIMGOBJ, $savefile); Break; Case 2: imagejpeg ($SRCIMGOBJ, $savefile); Break; Case 3: Imagepng ($SRCIMGOBJ, $savefile); Break; default:return 'Save failed';//Save failed } return$savefile; Imagedestroy ($SRCIMGOBJ); }} $image _blur=NewImage_blur ();
The value of Blurfactor represents the degree of ambiguity, Savepath is directly covered when empty, Savename is empty directly with the original
$image _blur->gaussian_blur ($srcImg ="./5.jpg", $savepath =null, $ Savename=null, $blurFactor =5);
?>
This method Baidu to, there is an interview I let me do, Baidu a pile of data to achieve.
The value of Blurfactor represents the degree of ambiguity
Effect Show:
Original
Degree of ambiguity 2
Degree of ambiguity 3
Degree of ambiguity 4
Degree of ambiguity 5
Degree of ambiguity 6
Degree of ambiguity 7
Using Gaussian algorithm to realize image fuzzy processing