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
This commit is contained in:
ryan 2012-05-14 17:53:03 +00:00
parent 28d2b205d8
commit 52e7e65d2d
1 changed files with 2 additions and 0 deletions

View File

@ -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. // using a replication plugin.
wp_mkdir_p( dirname( $dst_file ) ); 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 ) ) if ( 'image/png' == $image_type && imagepng( $dst, $dst_file ) )
return $dst_file; return $dst_file;
elseif ( imagejpeg( $dst, $dst_file, apply_filters( 'jpeg_quality', 90, 'wp_crop_image' ) ) ) elseif ( imagejpeg( $dst, $dst_file, apply_filters( 'jpeg_quality', 90, 'wp_crop_image' ) ) )