mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Remove old files from 'temp' directory
This commit is contained in:
@@ -470,6 +470,9 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
|
||||
$response['handle_upload'] = $movefile;
|
||||
|
||||
// Remove old files from 'temp' directory
|
||||
UM()->files()->remove_old_files( UM()->files()->upload_temp );
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -638,6 +641,9 @@ if ( ! class_exists( 'um\core\Uploader' ) ) {
|
||||
|
||||
$response['handle_upload'] = $movefile;
|
||||
|
||||
// Remove old files from 'temp' directory
|
||||
UM()->files()->remove_old_files( UM()->files()->upload_temp );
|
||||
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -1016,14 +1022,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