From 52e7e65d2d5c56d9843a6f3fc5a465b89cfd2b22 Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 14 May 2012 17:53:03 +0000 Subject: [PATCH] Make the file names unique for cropped header images. Props SergeyBiryukov. fixes #20666 git-svn-id: http://core.svn.wordpress.org/trunk@20787 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/image.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/wp-admin/includes/image.php b/wp-admin/includes/image.php index 2811c1b8e..5c90e2b89 100644 --- a/wp-admin/includes/image.php +++ b/wp-admin/includes/image.php @@ -93,6 +93,8 @@ function wp_crop_image( $src, $src_x, $src_y, $src_w, $src_h, $dst_w, $dst_h, $s // using a replication plugin. wp_mkdir_p( dirname( $dst_file ) ); + $dst_file = dirname( $dst_file ) . '/' . wp_unique_filename( dirname( $dst_file ), basename( $dst_file ) ); + if ( 'image/png' == $image_type && imagepng( $dst, $dst_file ) ) return $dst_file; elseif ( imagejpeg( $dst, $dst_file, apply_filters( 'jpeg_quality', 90, 'wp_crop_image' ) ) )