简体   繁体   English

压缩上传的图像在magento中

[英]compress uploaded images in magento

Is it possible to compress the original product image on upload in magento? 是否可以在magento上传时压缩原始产品图像? Magento saves the original uploaded image in full size. Magento以原始尺寸保存原始上传的图像。 The store admin have 3MB images and 20K products. 商店管理员有3MB图像和20K产品。 I want to automatically resize the images to ~150K. 我想自动将图像大小调整为~150K。

Thanks 谢谢

Magento automatically re-compresses product images before displaying them on the frontend. Magento会在前端显示产品图像之前自动重新压缩产品图像。

Due to the nature of compression techniques you cannot easily target a specific file size as it depends a lot on the amount of detail in a picture. 由于压缩技术的性质,您无法轻松地定位特定文件大小,因为它很大程度上取决于图片中的细节数量。 A plain "large" (wide and tall) image can result in a smaller file than a complex "small" (narrow and short) image. 简单的“大”(宽和高)图像可以产生比复杂的“小”(窄和短)图像更小的文件。 First check the file sizes being served to customers and then decide if it's worth pursuing. 首先检查提供给客户的文件大小,然后确定是否值得追求。

如果您真的必须通过管理员进行大小调整,您可以将事件观察者绑定到产品保存并编写脚本以减小原始图像的大小。

It may be fastest to use Photoshop or some related to resize the images to the largest useful size for the store. 使用Photoshop或其他一些相关的将图像大小调整为商店的最大有用大小可能是最快的。 This should be a relatively small JPG, and will largely obviate the issue. 这应该是一个相对较小的JPG,并将在很大程度上消除这个问题。 As a side benefit, uploading new images will be many times faster. 作为附带好处,上传新图像的速度要快很多倍。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM