function About_phpthumb () {
- Require_once './js/phpthumb/thumblib.inc.php ';
Instantiate the class library, the address of the image you want to work with can be a network address, or it can 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 (100, 100);
- $thumb->show ();
Reduce the picture to the original percentage, such as 50 is the original 50%.
- $thumb->resizepercent (50);
- $thumb->show ();
Intercept a 175px * 175px picture, note that this is the intercept, the part of the excess is cut off directly, is not forced to change the size.
- $thumb->adaptiveresize (175, 175);
- $thumb->show ();
From the center of the image, capture 200px * 100px images.
- $thumb->cropfromcenter (200, 100);
- $thumb->show ();
, the first two parameters are the coordinates x, y of the upper-right corner of the picture that needs to be solved. The following two parameters are required to solve the picture width, height.
- $thumb->crop (100, 100, 300, 200);
- $thumb->show ();
Invert the picture clockwise by 180 degrees.
- $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 ();
$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 (300, 300);
- $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
- }
Copy CodeAttached, phpthumb download the Image processing Class library address: Https://github.com/masterexploder/PHPThumb |