Hi,
I have two more questions concerning handling of profile images (=avatar) in a self-made "Edit Profile" form:
1. I want the "delete_image" checkbox to be disabled if there isn't anything saved in Data.avatar. I tried:
It doesn't work...
2. If there is an old picture (Data.avatar) and picture (avatar) is renewed or "delete_image"-checkbox is clicked (activated), then the old profile picture should be deleted. I copied the path from the image upload FAQ but it doens't work (which means the picture is not deleted). This is a Load JS custom code before file upload action:
What is wrong here?
Thanks in advance.
Christian
I have two more questions concerning handling of profile images (=avatar) in a self-made "Edit Profile" form:
1. I want the "delete_image" checkbox to be disabled if there isn't anything saved in Data.avatar. I tried:
window.onload = img;
function img() {
if (!jQuery("[name='Data[avatar]']").val()){document.getElementById('delete_image').disabled=true;}
}
It doesn't work...
2. If there is an old picture (Data.avatar) and picture (avatar) is renewed or "delete_image"-checkbox is clicked (activated), then the old profile picture should be deleted. I copied the path from the image upload FAQ but it doens't work (which means the picture is not deleted). This is a Load JS custom code before file upload action:
<?php
if ($form->data['delete_image'] == 'yes') {
$form->data['avatar'] = '';
if ($form->data['Data']['avatar']) {
unlink('JURI::root()."components/com_arrange2drive/media/users/{$form->data['Data']['avatar']}');
}
}
if ($form->data['Data']['avatar'] && $form->data['avatar']) {
unlink('JURI::root()."components/com_arrange2drive/media/users/{$form->data['Data']['avatar']}');
?>
What is wrong here?
Thanks in advance.
Christian