*/ $obj = new AjaxRequest(); /* * -------------------------- * Root of Photo * ------------------------- */ $root = '../cover/'; $photo_id = $_GET['token_id']; $photo_id_large = 'large_' . $_GET['token_id']; $infoUser = $obj->infoUserLive($_SESSION['authenticated']); $imgOld = $infoUser->cover_image; /* * -------------------------- * 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->uploadCover(''); echo 'TRUE'; } } } //<-- session } //<-- if token id
/* Large Image */ copy($path . $photo_large, $path_cover . $photo_large); unlink($path . $photo_large); } //<--- IF FILE EXISTS #2 //<<<-- Delete old image -->>>/ if (file_exists($coverOld) && $infoUser->cover_image != '' && $photo_post_id) { unlink($coverOld); } //<--- IF FILE EXISTS #1 if (file_exists($imgOldLarge)) { unlink($imgOldLarge); } //<--- IF FILE EXISTS #1 //<<<--- * UPDATE DB * -->>> $obj->uploadCover($photo_post_id); echo json_encode(array('output' => '', 'error' => 0, 'photo' => $photo_post)); } else { echo json_encode(array('output' => $_SESSION['LANG']['error'], 'error' => 1)); } //<--- Width && Height } else { echo json_encode(array('output' => $_SESSION['LANG']['width_height_min'], 'error' => 1)); } } else { echo json_encode(array('output' => $_SESSION['LANG']['max_size_5'], 'error' => 1)); } } else { echo json_encode(array('output' => $_SESSION['LANG']['formats_available'], 'error' => 1)); } } else {