-
-
function about_phpthumb(){ - require_once './js/phpthumb/ThumbLib.inc.php';
//instantiation Class library, the address of the image you want to process can be a network address or a local address
- $thumb = PhpThumbFactory::create('./images/cake.png');
- < p>//Reduce the image to a maximum width of 100px or a maximum of 100px. When only one parameter is entered, it is the widest size limit.
- $thumb->resize(100, 100);
- //$thumb->show();
//Reduce the image to the original percentage, such as 50 50% of the original.
- $thumb->resizePercent(50);
- //$thumb->show();
//Intercept a 175px * 175px picture. Note that this is an interception, beyond Parts are directly cropped, rather than forced to change size.
- $thumb->adaptiveResize(175, 175);
- //$thumb->show();
//Calculate from the center of the image and intercept the 200px * 100px image.
- $thumb->cropFromCenter(200, 100);
- //$thumb->show();
//Screenshot, the first two parameters are the pictures that need to be solved. The coordinates X, Y of the upper right corner. The last two parameters are the width and height of the image that need to be solved.
- $thumb->crop(100, 100, 300, 200);
- //$thumb->show();
//Reverse the picture 180 degrees clockwise
- $thumb->rotateImageNDegrees(180);
- //$thumb->show();
try{
- $thumb = PhpThumbFactory::create('./images/girl. png');
- }
- catch(Exception $e){
- throw $e;
- }
$thumb->crop(100, 100, 300, 200);
- // $thumb->show();
$thumb->cropFromCenter(200, 100);
- //$thumb->show();
- < ;p>$thumb->adaptiveResize(250, 250)->createReflection(40, 80, 80, true, '#a4a4a4'); //Reflection (reflection), the color is the border color of the original image
- // $thumb->show();
$thumb->rotateImage('CW');
- //$thumb->show();
- < ;p>$thumb->adaptiveResize(300, 300);
- $thumb->save('./images/girl2.jpg','jpg'); //Save the image, the first parameter is after saving The name of the image, the second parameter is the conversion format of the image
$thumb->resize(150,200)->cropFromCenter(100)->show(); //Chain lock Function
- }
-
Copy the code
Attached, the download address of the phpthumb image processing library:
https://github.com/masterexploder/PHPThumb
|