wp_crop_image


wp_crop_image ( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false )

Parameters:
  • (string|int) src The source file or Attachment ID.
  • (int) src_x The start x position to crop from.
  • (int) src_y The start y position to crop from.
  • (int) src_w The width to crop.
  • (int) src_h The height to crop.
  • (int) dst_w The destination width.
  • (int) dst_h The destination height.
  • (bool|false) src_abs Optional. If the source crop points are absolute.
  • (string|false) dst_file Optional. The destination file to write to.
Returns:
  • (string|WP_Error) New filepath on success, WP_Error on failure.
Defined at:

Description

Crops an image to a given size.

Related Functions

wp_ajax_crop_image, wp_load_image, wp_restore_image, wp_stream_image, _copy_image_file

Top Google Results

User discussions

wpseek mobile