Scale down an image to fit a particular size and save a new copy of the image.
Description
The PNG transparency will be preserved using the function, as well as the image type. If the file going in is PNG, then the resized image is going to be PNG. The only supported image types are PNG, GIF, and JPEG. Some functionality requires API to exist, so some PHP version may lose out support. This is not the fault of WordPress (where functionality is downgraded, not actual defects), but of your PHP version.
Parameters
$filestring
Image file path.
$max_wint
Maximum width to resize to.
$max_hint
Maximum height to resize to.
$cropbooloptional
Whether to crop image or resize. Default false.Default: false
$suffixstringoptional
File suffix. Default null.Default: null
$dest_pathstringoptional
New image file path. Default null.Default: null
$jpeg_qualityintoptional
Image quality percentage. Default 90.Default: 90
Return
mixed
WP_Error on failure. String with new destination path.
Signature, return type and hooks compared across 5 parsed releases.
3.5.0
Deprecated. Use wp_get_image_editor()from the docblock
2.5.0
Introduced.from the docblock
About this page
Parsed data
Generated from the wordpress-develop 7.0.4 tag, from src/wp-includes/deprecated.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.