mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
Return WP_Error from wp_crop_image() if saving has failed. props macbrink. fixes #23325.
git-svn-id: http://core.svn.wordpress.org/trunk@23374 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
2cb5fccd5c
commit
2967871d34
@ -20,7 +20,7 @@
|
||||
* @param int $dst_h The destination height.
|
||||
* @param int $src_abs Optional. If the source crop points are absolute.
|
||||
* @param string $dst_file Optional. The destination file to write to.
|
||||
* @return string|WP_Error|false New filepath on success, WP_Error or false on failure.
|
||||
* @return string|WP_Error New filepath on success, WP_Error on failure.
|
||||
*/
|
||||
function wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) {
|
||||
$src_file = $src;
|
||||
@ -54,6 +54,9 @@ function wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $s
|
||||
$dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) );
|
||||
|
||||
$result = $editor->save( $dst_file );
|
||||
if ( is_wp_error( $result ) )
|
||||
return $result;
|
||||
|
||||
return $dst_file;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user