image_get_intermediate_size
云策文档标注
概述
image_get_intermediate_size 是一个 WordPress 过滤器钩子,用于修改 image_get_intermediate_size() 函数返回的图像中间尺寸数据。它允许开发者自定义图像路径、宽度和高度等信息。
关键要点
- 过滤器名称:image_get_intermediate_size
- 参数:$data(数组,包含文件相对路径、宽度和高度,可能还包括绝对路径和URL)、$post_id(整数,图像附件的ID)、$size(字符串或整数数组,请求的图像尺寸)
- 用途:过滤 image_get_intermediate_size() 的输出,常用于调整图像尺寸数据或添加额外信息
- 相关函数:image_get_intermediate_size() 用于检索图像的中间尺寸路径、宽度和高度
- 引入版本:4.4.0
原文内容
Filters the output of image_get_intermediate_size()
Description
See also
Parameters
$dataarray-
Array of file relative path, width, and height on success. May also include file absolute path and URL.
$post_idint-
The ID of the image attachment.
$sizestring|int[]-
Requested image size. Can be any registered image size name, or an array of width and height values in pixels (in that order).
Source
return apply_filters( 'image_get_intermediate_size', $data, $post_id, $size );
Changelog
| Version | Description |
|---|---|
| 4.4.0 | Introduced. |