WordPress默认可以使用Imagick或GD库处理图像。Imagick因为会耗尽可用内存并导致无法上传。
为避免此问题,需要将GD库设置为默认编辑处理库。只需将下面的代码放到主题的 functions.php 文件中即可:
function hs_image_editor_default_to_gd( $editors ) {
$gd_editor = 'WP_Image_Editor_GD';
$editors = array_diff( $editors, array( $gd_editor ) );
array_unshift( $editors, $gd_editor );
return $editors;
}
add_filter( 'wp_image_editors', 'hs_image_editor_default_to_gd' );

1 条评论
Reason · 2021年2月21日 下午2:38
新版wordpress有很多硬伤,以后慢慢解决吧,都没法用了快