PHP:图像上传、缩略图、特定作物
我创建了一个脚本,它实现 jCrop 以在显示图像之前裁剪图像。在 CMS 中,客户需要能够上传徽标,该徽标适合我们设计师确定的特定尺寸。
所以我想我正在寻找可以裁剪、调整大小和保存原始版本、特定大小的版本以及可能的其他缩略图大小的东西。
请问有人可以为此建议一个好的可靠且漂亮的防弹方法吗?到目前为止,我正在使用 GD 并传入 jCrop 坐标来创建图像。这给客户带来了混乱,因为他们上传巨大的图像和小图像,并且显然存在结果不正确的各种问题。
我认为一个类可能是一个想法,我发现了这个, http://pear.php.net /package/Image_Transform 虽然我还没有真正尝试过。
由于图像上传现在已成为网站的主流功能,那么人们处理这种潜在的用户输入黑洞的技巧是什么?
目前我验证上传 <100kb 和 bmp、gif、jpg 和 png
I've created a script which implements jCrop to crop an image before displaying it. In the CMS the client needs to be able to upload logos, which fit a specific size as determined by our designer.
So I think I'm looking for something which can crop, resize and save out the original, a specific sized version and potentially other thumbnail sizes.
Please can anyone suggest a good solid, and pretty bullet proof method for this? So far I am using GD and passing in jCrop coords to create an image. It's causing chaos for the client, as they are uploading huge images and small ones and obviously having all kinds of issues with the results not being correct.
I figured that a class might be an idea, and I found this, http://pear.php.net/package/Image_Transform although I haven't actually tried it out yet.
As image uploads are such a mainstream feature of sites now, what are peoples tips for handling this potential black hole of user input?
Presently I validate on upload for <100kb and bmp, gif, jpg and png
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
此链接有一个非常可靠的图像操作类: http://www.codewalkers.com/c/a/GUI-Code/PHP-Image-Manipulation-Class-10/
摘自上面链接的页面:
There is a pretty solid image manip class at this link: http://www.codewalkers.com/c/a/GUI-Code/PHP-Image-Manipulation-Class-10/
Excerpt from the page linked above:
设法使用 PEAR 类获得足够可靠的解决方案! :D
Managed to get a solid enough solutions using the PEAR class! :D