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:
Ryan Boren
2009-12-23 18:39:31 +00:00
parent 95ea3693b1
commit 7ccd64fbe7
3 changed files with 10 additions and 4 deletions
+3 -3
View File
@@ -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 );