image_resize_dimensions
函数
image_resize_dimensions ( $orig_w, $orig_h, $dest_w, $dest_h, $crop = false )
- 参数
-
-
(int)
$orig_w
Original width in pixels.- Required: 是
-
(int)
$orig_h
Original height in pixels.- Required: 是
-
(int)
$dest_w
New width in pixels.- Required: 是
-
(int)
$dest_h
New height in pixels.- Required: 是
-
(bool|array)
$crop
Optional. Whether to crop image to specified width and height or resize. An array can specify positioning of the crop area. Default false.- Required: 否
- Default: false
-
(int)
- 返回值
-
- (array|false) Returned array matches parameters for `imagecopyresampled()`. False on failure.
- 定义位置
-
-
wp-includes/media.php
, line 530
-
wp-includes/media.php
- 引入
- 2.5.0
- 弃用
- –
Retrieves calculated resize dimensions for use in WP_Image_Editor.
Calculates dimensions and coordinates for a resized image that fits
within a specified width and height.
Cropping behavior is dependent on the value of $crop:
1. If false (default), images will not be cropped.
2. If an array in the form of array( x_crop_position, y_crop_position ):
– x_crop_position accepts ‘left’ ‘center’, or ‘right’.
– y_crop_position accepts ‘top’, ‘center’, or ‘bottom’.
Images will be cropped to the specified dimensions within the defined crop area.
3. If true, images will be cropped to the specified dimensions using center positions.
function image_resize_dimensions( $orig_w, $orig_h, $dest_w, $dest_h, $crop = false ) { if ( $orig_w
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。