WPDev.one
Core Function
View Source on Trac ↗

image_constrain_size_for_editor()

image_constrain_size_for_editor( mixed $width, mixed $height, mixed $size = 'medium', mixed $context = null )

Scales down the default size of an image.

Parameters 4 required

Name / Type Description
$width
int

Width of the image in pixels.

Required
$height
int

Height of the image in pixels.

Required
mixed

(string | int[]) $size Optional. Image size. Accepts any registered image size name, or an array of width and height values in pixels (in that order). Default 'medium'.

Required
string

$context Optional. Could be 'display' (like in a theme) or 'edit' (like inserting into an editor). Default null.

Required

Return Value

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

Function Information

Since Version
2.5.0
Source File
wp-includes/media.php
Advertisement