mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Task: Avatar upload issues
Link: https://secure.helpscout.net/conversation/783141631/28212?folderId=1405025
This commit is contained in:
@@ -868,17 +868,22 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
|
||||
/**
|
||||
* Make unique filename
|
||||
* @param string $dir
|
||||
* @param string $filename
|
||||
* @param string $ext
|
||||
* @param string $dir
|
||||
* @return string $filename
|
||||
*
|
||||
* @since 2.0.22
|
||||
*/
|
||||
public function unique_filename( $filename, $ext, $dir ) {
|
||||
$image_type = wp_check_filetype( $ext );
|
||||
public function unique_filename( $dir, $filename, $ext ) {
|
||||
|
||||
$ext = $image_type['ext'];
|
||||
if ( empty( $ext ) ) {
|
||||
$image_type = wp_check_filetype( $filename );
|
||||
$ext = strtolower( trim( $image_type['ext'], ' \/.' ) );
|
||||
}
|
||||
else {
|
||||
$ext = strtolower( trim( $ext, ' \/.' ) );
|
||||
}
|
||||
|
||||
if ( 'image' == $this->upload_type ) {
|
||||
|
||||
@@ -1016,14 +1021,14 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
|
||||
$resize = $image->multi_resize( $sizes_array );
|
||||
|
||||
// change filenames of resized images
|
||||
// change filenames of resized images
|
||||
foreach( $resize as $row ){
|
||||
$new_filename = str_replace( "x{$row['height']}" , "", $row["file"] );
|
||||
$old_filename = $row["file"];
|
||||
|
||||
$old_filename = $row["file"];
|
||||
|
||||
rename( dirname( $image_path ) . DIRECTORY_SEPARATOR . $old_filename, dirname( $image_path ) . DIRECTORY_SEPARATOR . $new_filename );
|
||||
}
|
||||
|
||||
|
||||
} else {
|
||||
wp_send_json_error( esc_js( __( "Unable to crop image file: {$src}", 'ultimate-member' ) ) );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user