mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-06-05 15:09:37 +09:00
Fix image upload
This commit is contained in:
+12
-7
@@ -540,15 +540,20 @@ class UM_Files {
|
||||
}
|
||||
|
||||
$ext = '.' . pathinfo($source, PATHINFO_EXTENSION);
|
||||
$name = $key;
|
||||
$filename = $name . $ext;
|
||||
|
||||
|
||||
// copy & overwrite file
|
||||
|
||||
if( in_array( $key , array('profile_photo','cover_photo') ) ){
|
||||
$filename = $key . $ext;
|
||||
}else{
|
||||
$filename = basename( $source );
|
||||
}
|
||||
|
||||
if ( file_exists( $this->upload_basedir . $user_id . '/' . $filename ) ) {
|
||||
unlink( $this->upload_basedir . $user_id . '/' . $filename );
|
||||
}
|
||||
copy( $source, $this->upload_basedir . $user_id . '/' . $filename );
|
||||
|
||||
|
||||
$info = @getimagesize( $source );
|
||||
|
||||
// thumbs
|
||||
@@ -596,9 +601,7 @@ class UM_Files {
|
||||
// removes a synced profile photo
|
||||
delete_user_meta( $user_id, 'synced_profile_photo' );
|
||||
|
||||
}
|
||||
|
||||
if ( $key == 'cover_photo' ) {
|
||||
}else if ( $key == 'cover_photo' ) {
|
||||
|
||||
list($w, $h) = @getimagesize( $source );
|
||||
|
||||
@@ -636,6 +639,8 @@ class UM_Files {
|
||||
|
||||
}
|
||||
|
||||
}else{
|
||||
|
||||
}
|
||||
|
||||
// clean up temp
|
||||
|
||||
Reference in New Issue
Block a user