Ticket #16458: 16458.diff
| File 16458.diff, 1.2 KB (added by , 14 years ago) |
|---|
-
wp-includes/media.php
442 442 if ( !is_null($dest_path) and $_dest_path = realpath($dest_path) ) 443 443 $dir = $_dest_path; 444 444 $destfilename = "{$dir}/{$name}-{$suffix}.{$ext}"; 445 446 // If the file already exists, add a numeric suffix and increment it until 447 // the new file name is available 448 if ( file_exists($destfilename) ) { 449 $i = 1; 450 do { 451 $destfilename = "{$dir}/{$name}{$i}-{$suffix}.{$ext}"; 452 $i++; 453 } while ( file_exists($destfilename) ); 454 } 445 455 446 456 if ( IMAGETYPE_GIF == $orig_type ) { 447 457 if ( !imagegif( $newimage, $destfilename ) ) … … 451 461 return new WP_Error('resize_path_invalid', __( 'Resize path invalid' )); 452 462 } else { 453 463 // all other formats are converted to jpg 454 $destfilename = "{$dir}/{$name}-{$suffix}.jpg";464 $destfilename = substr($destfilename, 0, 0 - strlen($ext)) . 'jpg'; 455 465 if ( !imagejpeg( $newimage, $destfilename, apply_filters( 'jpeg_quality', $jpeg_quality, 'image_resize' ) ) ) 456 466 return new WP_Error('resize_path_invalid', __( 'Resize path invalid' )); 457 467 }