首页 WordPress函数大全 image_downsize()

image_downsize()

2020-05-02 / 2326阅 / 悠然

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

image_downsize( int $id, string|int[] $size = 'medium' )

Scale an image to fit a particular size (such as ‘thumb’ or ‘medium’).

描述

The URL might be the original image, or it might be a resized version. This function won’t create a new resized copy, it will just return an already resized>‘image_downsize’ filter to hook into and offer image resizing services for images. The hook must return an array with the same elements that are normally returned from the function.

参数

$id

(int)
(Required)
Attachment ID for image.

$size

(string|int[])
(Optional)
Image size to scale to. Accepts any valid image size name, or an array of width and height values in pixels (in that order).

Default value: 'medium'

返回

(array|false) Array of image data, or boolean false if no image is available.

  • (string) Image source URL.
  • '1'
    (int) Image width in pixels.
  • '2'
    (int) Image height in pixels.
  • '3'
    (bool) Whether the image is a resized image.
大家谈论
    我的见解