[英]How do I open an image and re-save it using ImageMagick?
I'm doing it to image uploads to prevent any embedded malicious code. 我这样做是为了上传图片,以防止任何嵌入的恶意代码。 Am I right in doing this? 我这样做正确吗?
But yeah my main question is how to actually do it, because I've never used ImageMagick before - I've just installed it on my server. 但是,是的,我的主要问题是如何实际执行此操作,因为我以前从未使用过ImageMagick,而是将其安装在服务器上。
There is no way any code in images should be able to execute itself on your server. 图像中的任何代码都无法在服务器上自行执行。 Unless you actually parse images for code on request (never do that), you're far better & efficient off just serving the images (do not include()
them in any code of course), just add them to the browser), and let virus-scanning software scan newly uploaded images in the background, with clamav for instance. 除非您实际上是根据请求解析图像以获取代码(从不这样做),否则仅提供图像会更好,更有效(当然,不要在任何代码中都include()
它们,只需将它们添加到浏览器中),然后让病毒扫描软件在后台扫描新上传的图像,例如clamav。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.