首页 WordPress函数大全 image_resize()

image_resize()

2020-05-02 / 4981阅 / 悠然

如何你看完本文还不知道如何使用该函数,可以联系我定制视频教程,50元/个函数,学不会全额退款

Warning: This function has been deprecated. Use wp_get_image_editor() instead.

image_resize( string $file, int $max_w, int $max_h, bool $crop = false, string $suffix = null, string $dest_path = null, int $jpeg_quality = 90 )

Scale down an image to fit a particular size and save a new copy of the image.

描述

The PNG transparency will be preserved using the function, as well as the image type. If the file going in is PNG, then the resized image is going to be PNG. The id="see-also" tabindex="-1">See also See also

  • wp_get_image_editor()

Top ↑

参数

$file

(string)
(Required)
Image file path.

$max_w

(int)
(Required)
Maximum width to resize to.

$max_h

(int)
(Required)
Maximum height to resize to.

$crop

(bool)
(Optional)
Whether to crop image or resize.

Default value: false

$suffix

(string)
(Optional)
File suffix.

Default value: null

$dest_path

(string)
(Optional)
New image file path.

Default value: null

$jpeg_quality

(int)
(Optional)
Image quality percentage.

Default value: 90

返回

(mixed) WP_Error on failure. String with new destination path.

大家谈论
    我的见解