This article illustrates the use of a Gaussian algorithm in PHP to implement the fuzzy processing function of the image. Share to everyone for your reference, specific as follows:
<?php class image_blur{function Gaussian_blur ($srcImg, $savepath =null, $savename =null, $blurFactor =3) {$gdImageRe
Source= $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]) {case1:imagegif ($SRCIMGOBJ, $savefile); Case2:imagejpeg ($SRCIMGOBJ, $savefile);
Break Case3:imagepng ($SRCIMGOBJ, $savefile);
Break Default:return ' save failed ';
Save failed} return $savefile;
Imagedestroy ($SRCIMGOBJ);
}} $image _blur = new Image_blur (); The Blurfactor value represents the ambiguity degree, Savepath is the empty time direct cover, the savename is the empty direct use formerly known as $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 information to achieve.
The value of the Blurfactor represents the degree of ambiguity
Effect Display:
Original:
Blur degree 2
Blur degree 3
Blur degree 4
Blur degree 5
Blur degree 6
Blur degree 7
More about PHP Interested readers can view the site topics: "PHP graphics and pictures Operating skills summary", "PHP file Operation Summary", "PHP Array" operation Skills Encyclopedia, "PHP Basic Grammar Introductory Course", "PHP Operations and Operator Usage Summary", " Introduction to PHP object-oriented programming program, "PHP Network Programming Skills Summary", "PHP string (String) Usage Summary", "Php+mysql database Operation Tutorial" and "PHP common database Operation Skills Summary"
I hope this article will help you with the PHP program design.