Support

  1. czarrna
  2. General
  3. Tuesday, February 02 2016, 03:44 PM
Hi,

I am testing uploading avatars for users and it works perfect including crop and rotate. Thanks so much for this excellent improvement! :D

I've noticed an issue when a user wants to change the image - he/she can but the old profile image is not removed even if "delete image" is thicked.

So, considering hundreds of users that would likely want to change their images from time to time - it will be a mess and it will take some space on the server.

Any ideas how to deal with this??


Many thanks
Accepted Answer
admin Accepted Answer
Admin
Thx for report it, we will solve in next release.

Add this code in file /administrator/components/com_jsn/helpers/fields/image.php after line 173:
foreach (glob($upload_dir.$alias.$data['id'].'*') as $deletefile)
{
unlink($deletefile);
}


so become something like this:
........
$md5=md5(time().rand());
$filename=$alias.$data['id'].'_'.$md5.'.png';
$filename_mini=$alias.$data['id'].'mini_'.$md5.'.png';
$path = JPATH_SITE.'/images/_tmp/';
$file = $session->get('_tmp_img_'.$alias,'');
if(file_exists($path . str_replace('.','-big.',$file)) && file_exists($path . str_replace('.','-big.',$file))){
////// START NEW CODE
foreach (glob($upload_dir.$alias.$data['id'].'*') as $deletefile)
{
unlink($deletefile);
}
////// END NEW CODE
rename($path . str_replace('.','-big.',$file),$upload_dir.$filename);
rename($path . str_replace('.','-mini.',$file),$upload_dir.$filename_mini);
unlink($path . $file);
$storeData[$alias]=$upload_path.$filename;
}
......


This remove also oldest image ;)
  1. more than a month ago
  2. General
  3. # Permalink
czarrna Accepted Answer
Content Protected
  1. more than a month ago
  2. General
  3. # 1
admin Accepted Answer
Admin
hi,
strange this code was tested. anyway, on localhost we can't check your problem, so try to see your PHP error log.
  1. more than a month ago
  2. General
  3. # 2
czarrna Accepted Answer
Content Protected
  1. more than a month ago
  2. General
  3. # 3
  • Page :
  • 1


There are no replies made for this post yet.
However, you are not allowed to reply to this post.

Request Support

Support is currently Offline

Support Availability

Working days: Monday to Friday. The support staff is not available on weekends; in the most of cases tickets will not be answered during that time.

Reply time: Depending on the complexity of your support issue it's usually between a few minutes and 24 hours for paid members and about one week for free members. When we expect longer delays we will notify you.

Guidelines

Before you post: read the documentation and search the forums for an answer to your question.

When you post: include Site Details if you request a support (you can use the form below the reply in Site Details tab).

Auto Solved Question: If after a week the author of the post does not reply to a request by moderator, the question will be marked as resolved.

Language: only English

Search Users

Easy Profile® is not affiliated with or endorsed by Open Source Matters or the Joomla Project. Joomla is Free Software released under the GNU/GPL License.