简体   繁体   English

如何打开图像并使用ImageMagick重新保存?

[英]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.

相关问题 用php和zend裁剪后如何重新保存图像? - how to re-save image after cropping with php and zend? 如何将实体重新保存为 Doctrine 2 中的另一行 - How to re-save the entity as another row in Doctrine 2 Magento中的可配置产品在重新保存之前不会显示属性 - Configurable products in Magento don't show attributes before I re-save it Symfony2 / Doctrine:如何将OneToMany实体重新保存为级联新行 - Symfony2/Doctrine: How to re-save an entity with a OneToMany as a cascading new row 如何使用Imagemagick将转换后的JPG图像从PDF保存到数据库 - How to save converted JPG image from PDF using Imagemagick to database 使用PHP Imagick(ImageMagick)转换为PCL时如何将图像设置为高质量 - how do i set the image to high quality when converting to PCL using PHP Imagick (ImageMagick) 将图像保存在RAM上并使用ImageMagick对其进行处理 - Save image on RAM and work on it using ImageMagick 如何使用ImageMagick替换图像中的白色矩形? - How can I replace the white rectangle within an image using ImageMagick? 如何使用带管道的PHP将内嵌图像保存在电子邮件中? - How do I save an inline image in an email using piping with PHP? 通过 PHP / Laravel 编辑现有导出的 csv 文件并重新保存 - Edit an existing exported csv file via PHP / Laravel and re-save
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM