Core Function
View Source on Trac ↗ wp_crop_image()
wp_crop_image(
mixed $src,
mixed $src_x,
mixed $src_y,
mixed $src_w,
mixed $src_h,
mixed $dst_w,
mixed $dst_h,
mixed $src_abs = false,
mixed $dst_file = false
) Crops an image to a given size.
Parameters 9 required
| Name / Type | Description |
|---|---|
| (string | | int) $src The source file or Attachment ID. Required |
| $src_x int | The start x position to crop from. Required |
| $src_y int | The start y position to crop from. Required |
| $src_w int | The width to crop. Required |
| $src_h int | The height to crop. Required |
| $dst_w int | The destination width. Required |
| $dst_h int | The destination height. Required |
| (bool | | false) $src_abs Optional. If the source crop points are absolute. Required |
| (string | | false) $dst_file Optional. The destination file to write to. Required |
Return Value
((string)
| WP_Error) New filepath on success, WP_Error on failure.
Function Information
Since Version
2.1.0
Source File
wp-admin/includes/image.php
Advertisement