*/ $obj = new AjaxRequest(); /* * -------------------------- * Root of Photo * ------------------------- */ $root = '../avatar/'; $photo_id = $_GET['token_id']; $photo_id_large = 'large_' . $_GET['token_id']; $infoUser = $obj->infoUserLive($_SESSION['authenticated']); $imgOld = $infoUser->avatar; /* * -------------------------- * Folder permissions * ------------------------- */ if ($imgOld == $photo_id) { chmod($root . $photo_id, 0777); if (file_exists($root . $photo_id)) { unlink($root . $photo_id); unlink($root . $photo_id_large); /* Update Database */ $obj->uploadAvatar('avatar.png'); echo 'TRUE'; } } } //<-- session } //<-- if token id
/* Large Image */ copy($path . $photo_large, $path_avatar . $photo_large); unlink($path . $photo_large); } //<--- IF FILE EXISTS #2 //<<<-- Delete old image -->>>/ if (file_exists($imgOld) && $imgOld != $path_avatar . 'avatar.png' && $photo_post_id) { unlink($imgOld); } //<--- IF FILE EXISTS #1 if (file_exists($imgOldLarge)) { unlink($imgOldLarge); } //<--- IF FILE EXISTS #1 //<<<--- * UPDATE DB * -->>> $obj->uploadAvatar($photo_post_id); echo json_encode(array('output' => '', 'error' => 0, 'photo' => $photo_post)); //<--- move_uploaded_file } else { echo json_encode(array('output' => $_SESSION['LANG']['error'], 'error' => 1)); } //<--- Width && Height } else { echo json_encode(array('output' => $_SESSION['LANG']['width_height_min_avatar'], 'error' => 1)); } // size } else { echo json_encode(array('output' => $_SESSION['LANG']['max_size_5'], 'error' => 1)); } // Formats Images } else {