wp_constrain_dimensions WordPress Filter Hook

The wp_constrain_dimensions hook is used to modify the width and height of an image. It can be used to keep a consistent aspect ratio or to make sure an image is a certain size.

apply_filters( 'wp_constrain_dimensions', int[] $dimensions, int $current_width, int $current_height, int $max_width, int $max_height ) #

Filters dimensions to constrain down-sampled images to.


Parameters

$dimensions

(int[])An array of width and height values.

  • (int) The width in pixels.
  • '1'
    (int) The height in pixels.

$current_width

(int)The current width of the image.

$current_height

(int)The current height of the image.

$max_width

(int)The maximum width permitted.

$max_height

(int)The maximum height permitted.


Top ↑

Source

File: wp-includes/media.php

View on Trac



Top ↑

Changelog

Changelog
VersionDescription
4.1.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More