mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-08-11 12:20:22 +00:00
Retunr WP_Error from wp_crop_image() and image_resize(). Props mdwaffe. fixes #9922
git-svn-id: https://develop.svn.wordpress.org/trunk@12524 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -38,7 +38,7 @@ function wp_create_thumbnail( $file, $max_side, $deprecated = '' ) {
|
||||
* @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 New filepath on success, String error message on failure.
|
||||
* @return string|WP_Error|false New filepath on success, WP_Error or false on failure.
|
||||
*/
|
||||
function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $src_abs = false, $dst_file = false ) {
|
||||
if ( is_numeric( $src_file ) ) // Handle int as attachment ID
|
||||
@@ -46,8 +46,8 @@ function wp_crop_image( $src_file, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_
|
||||
|
||||
$src = wp_load_image( $src_file );
|
||||
|
||||
if ( !is_resource( $src ))
|
||||
return $src;
|
||||
if ( !is_resource( $src ) )
|
||||
return new WP_Error( 'error_loading_image', $src, $src_file );
|
||||
|
||||
$dst = wp_imagecreatetruecolor( $dst_w, $dst_h );
|
||||
|
||||
|
||||
Reference in New Issue
Block a user