Php Gd 旋转图像
你好,
我正在尝试围绕中心旋转圆形图像,然后剪掉两侧。 我看到 imagerotate 函数,但它似乎没有绕中心旋转。
有人有什么建议吗?
谢谢。
更新:由于它是一个圆,我想剪掉边缘并使圆保持相同的尺寸。
HEllo,
I am trying to rotate a circular image around the center and then cut off the sides. I see the imagerotate function, but it does not seem to rotate about centre.
Anyone have any suggestions?
Thank you.
Update: Since it is a circle, I want to cut off the edges and keep my circle in the same dimensions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我使用以下代码成功地解决了这个问题
希望它有帮助。
再见
I faced successfully that problem with the following code
Hope it helps.
Bye
文档说它确实旋转围绕中心。
不幸的是,它还说它将缩放图像以使其仍然适合。 这意味着无论您执行什么操作,此功能都会改变内部圆形图像的大小。
您可以(相对容易地)计算将发生多少缩放,然后预先适当地预先缩放图像。
如果您有 PHP“ImageMagick”函数可用,您可以使用它们来代替 - 它们显然不会缩放图像。
The documentation says that it does rotate around the center.
Unfortunately it also says that it will scale the image so that it still fits. That means that whatever you do this function will change the size of your internal circular image.
You could (relatively easily) calculate how much scaling down will happen and then prescale the image up appropriately beforehand.
If you have the PHP "ImageMagick" functions available you can use those instead - they apparently don't scale the image.
根据PHP手册imagerotate()页面:
也许图像的可见中心不是实际中心?
According to the PHP manual imagerotate() page:
Perhaps the visible center of the image is not the actual center?