image_resize_dimensions
Filter HookDescription
Filters whether to preempt calculating the image resize dimensions. Returning a non-null value from the filter will effectively short-circuit image_resize_dimensions(), returning that value instead.Hook Information
File Location |
wp-includes/media.php
View on GitHub
|
Hook Type | Filter |
Line Number | 569 |
Hook Parameters
Type | Name | Description |
---|---|---|
null|mixed
|
$null
|
Whether to preempt output of the resize dimensions. |
int
|
$orig_w
|
Original width in pixels. |
int
|
$orig_h
|
Original height in pixels. |
int
|
$dest_w
|
New width in pixels. |
int
|
$dest_h
|
New height in pixels. |
bool|array
|
$crop
|
Whether to crop image to specified width and height or resize. An array can specify positioning of the crop area. Default false. |
Usage Examples
Basic Usage
<?php
// Hook into image_resize_dimensions
add_filter('image_resize_dimensions', 'my_custom_filter', 10, 6);
function my_custom_filter($null, $orig_w, $orig_h, $dest_w, $dest_h, $crop) {
// Your custom filtering logic here
return $null;
}
Source Code Context
wp-includes/media.php:569
- How this hook is used in WordPress core
<?php
564 * @param int $dest_w New width in pixels.
565 * @param int $dest_h New height in pixels.
566 * @param bool|array $crop Whether to crop image to specified width and height or resize.
567 * An array can specify positioning of the crop area. Default false.
568 */
569 $output = apply_filters( 'image_resize_dimensions', null, $orig_w, $orig_h, $dest_w, $dest_h, $crop );
570
571 if ( null !== $output ) {
572 return $output;
573 }
574
PHP Documentation
<?php
/**
* Filters whether to preempt calculating the image resize dimensions.
*
* Returning a non-null value from the filter will effectively short-circuit
* image_resize_dimensions(), returning that value instead.
*
* @since 3.4.0
*
* @param null|mixed $null Whether to preempt output of the resize dimensions.
* @param int $orig_w Original width in pixels.
* @param int $orig_h Original height in pixels.
* @param int $dest_w New width in pixels.
* @param int $dest_h New height in pixels.
* @param bool|array $crop Whether to crop image to specified width and height or resize.
* An array can specify positioning of the crop area. Default false.
*/
Quick Info
- Hook Type: Filter
- Parameters: 6
- File: wp-includes/media.php
Related Hooks
Related hooks will be displayed here in future updates.