开发者

PHP: Create thumbnail of top left of picture

开发者 https://www.devze.com 2023-02-15 20:55 出处:网络
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.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消