PHP:创建图片左上角的缩略图

发布于 2024-10-20 20:45:30 字数 129 浏览 7 评论 0原文

我有这个大的 png 文件,现在我想创建左上角的缩略图。

png 大约是 600x1000 像素,缩略图应该位于其左上角 400x300 像素。

如果你能帮助我那就太好了! (因为谷歌只显示如何缩略图整张图片)

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 left 400x300 pixels of it.

Would be awesome if you can help me out! (Since google only shows how to thumbnail the ENTIRE picture)

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

热鲨 2024-10-27 20:45:30
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
                   );
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
                   );
浮萍、无处依 2024-10-27 20:45:30

您可以使用 PHP 中的 imagecopyresampled 函数复制源图像的一部分,并将其缩放到您想要的任何大小。

请检查 PHP 文档以了解该函数。

http://www.php.net/manual/en/function.imagecopyresampled.php

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文