I have this large png file and now I want to create a thumbnail of the upper left corner.
The png is like 600x1000 pixels, the thumbnail should be top lef开发者_开发技巧t 400x300 pixels of it.
Would be awesome if you can help me out! (Since google only shows how to thumbnail the ENTIRE picture)
imagecopyresampled( $top_left_image_thumb, //cropped thumbnail image
$original_image, //original image
0, 0, 0, 0, //top-left corners
$thumb_width, $thumb_height, //dst dimensions
400, 300 //src subarea dimensions
);
You can use imagecopyresampled function in PHP to copy part of a source image and also scale it to any size you want.
Please check the PHP documentation for the function.
http://www.php.net/manual/en/function.imagecopyresampled.php
精彩评论