This time to bring you phpthumb picture processing using the steps in detail, phpthumb picture processing use of the attention to what, the following is the actual case, together to see.
Example:
<?phpfunction About_phpthumb () {require_once './js/phpthumb/thumblib.inc.php ';//Instantiate class library, the address of the image you want to process can be a network address, It can also be a local address $thumb = Phpthumbfactory::create ('./images/cake.png ');//reduce the picture to a maximum width of 100px or up to 100px, when only one parameter is entered, the widest size is limited. $thumb->resize (s),//$thumb->show (),//To reduce the picture to the original percentage, such as 50 is the original 50%. $thumb->resizepercent ()///$thumb->show ();//Capture a 175px * 175px picture, note that this is the interception, the part of the excess directly cut off, is not forced to change the size. $thumb->adaptiveresize (175, 175);//$thumb->show ()///from the center of the image, capturing 200px * 100px images. $thumb->cropfromcenter (s),//$thumb->show ();//, the first two parameters are the coordinates x, y of the upper-right corner of the picture that need to be solved respectively. The following two parameters are required to solve the picture width, height. $thumb->crop (180, +, +),//$thumb->show ();//Turn the picture clockwise $thumb->rotateimagendegrees (180);//$ Thumb->show (); try{$thumb = Phpthumbfactory::create ('./images/girl.png ');} catch (Exception $e) {throw $e;} $thumb->crop (+, +, +),//$thumb->show (), $thumb->cropfromcenter (+),//$thumb->show (); $ Thumb->adaptiveresize (+)->createreflection (+, +), True,' #a4a4a4 '); Reflection (reflection), color is the border color of the original image//$thumb->show (); $thumb->rotateimage (' CW ');//$thumb->show (); $thumb Adaptiveresize (+), $thumb->save ('./images/girl2.jpg ', ' jpg '); Save the picture, the first parameter is the name of the saved picture, the second parameter is the conversion format of the picture $thumb->resize (150,200)->cropfromcenter ()->show (); Chain Lock Action}
Believe that you have read the case of this article you have mastered the method, more exciting please pay attention to the PHP Chinese network other related articles!
Recommended reading:
PHP Zip Compression class instance steps in detail
PHP cropping without affecting the shape of the image