在magento中压缩上传的图像
是否可以在magento中上传时压缩原始产品图像? Magento 以完整尺寸保存原始上传的图像。 商店管理员有 3MB 图像和 20K 产品。 我想自动将图像大小调整为 ~150K。
谢谢
Is it possible to compress the original product image on upload in magento?
Magento saves the original uploaded image in full size.
The store admin have 3MB images and 20K products.
I want to automatically resize the images to ~150K.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
使用 Photoshop 或其他相关工具将图像大小调整为商店可用的最大尺寸可能是最快的。这应该是一个相对较小的 JPG,并且可以在很大程度上消除该问题。另一个好处是,上传新图像的速度会快很多倍。
It may be fastest to use Photoshop or some related to resize the images to the largest useful size for the store. This should be a relatively small JPG, and will largely obviate the issue. As a side benefit, uploading new images will be many times faster.
如果您确实必须通过管理员调整大小,您也许可以绑定到产品保存的事件观察器并编写脚本来减小原始图像的大小。
If you really have to do the resizing through the admin, you might be able to tie into the event observer for the product save and write a script to reduce the size of the original image.
Magento 在前端显示产品图像之前会自动重新压缩产品图像。
由于压缩技术的性质,您无法轻松地确定特定的文件大小,因为它在很大程度上取决于图片中的细节量。普通的“大”(宽和高)图像可能会比复杂的“小”(窄和短)图像产生更小的文件。首先检查向客户提供的文件大小,然后决定是否值得追求。
Magento automatically re-compresses product images before displaying them on the frontend.
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.