使用PHP上传,调整大小和裁剪图像中心 [英] Upload, resize, and crop center of image with PHP

查看:106
本文介绍了使用PHP上传,调整大小和裁剪图像中心的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个非常基本的上传,调整大小和裁剪PHP脚本。
此功能与Twitter用于上传头像图片的方法相同(最后我检查过)。

I'm wanting to create a very very basic upload, resize, and crop PHP script. The functionality to this will be identical (last i checked anyway) to the method Twitter uses to upload avatar pictures.

我希望脚本可以采取任何大小图像,将最短边调整为116px,然后从顶部和底部裁剪(如果是横向则裁剪左右边),以获得116px×116px的正方形。

I want the script to take any size image, resize the shortest side to 116px, then crop off the top and bottom (or left and right side if it's landscape) as to get a square 116px by 116px.

我不想要一个膨胀的PHP脚本与客户端调整大小或任何东西,只是一个简单的PHP调整大小和裁剪。这是怎么做的?

I don't want a bloated PHP script with client side resizing or anything, just a simple PHP resize and crop. How is this done?

推荐答案

GD图书馆是一个很好的起点。

The GD Library is a good place to start.

http://www.php.net/manual/en/ book.image.php

这篇关于使用PHP上传,调整大小和裁剪图像中心的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆