在指导客户压缩图像时遇到困难,非常希望wordpress将图像压缩到预定义的大小(通常为800px长边,72dpi)并丢弃原始图像
图像可以自动压缩吗?
4 个回复
最合适的回答,由SO网友:Ünsal Korkmaz 整理而成
使用http://wordpress.org/extend/plugins/auto-image-resizer/
将此添加到您的函数中。php:
function prune_image_sizes($sizes) {
// You can add other size like that for remove those sizes
// unset($sizes[\'medium\']);
unset($sizes[\'large\']);
return $sizes;
}
add_filter(\'intermediate_image_sizes_advanced\', \'prune_image_sizes\');
在“媒体选项”面板中,将“大图像”选项设置为800px那你做了什么?系统不会创建大尺寸的图像,但会将原始图像大小减小到大尺寸(800px)选项。大多数开发人员都不喜欢它,但当客户端必须上传大量图像,并且没有那么多托管空间时,这会有所帮助
(对不起我的英语)
SO网友:Denis de Bernardy
Tried this plugin?
SO网友:Jan Fabry
我想如果你把$content_width
全局变量(在主题的functions.php
例如),所有图像的大小将调整为不超过该宽度。记住还要更改大图像大小的设置,否则it will be confusing to users why they can\'t use that size anymore.
SO网友:goldenapples
如果您关心的是丢弃原始图像以节省空间。我认为在调整大小后,您可能需要挂起“add\\u attachment”操作来删除原始文件。结合Jan关于将$content\\u width变量设置为最大大小的建议,这应该可以做到。
结束