예제 #1
0
     exit;
 }
 //computer album folder name and photo filename, if exist, shift bits
 //goal: generate a random yet computable file structure to disallow
 //		users to browse through others' photos through URLs.
 $album_file_path = getAlbumFilePath($id, $info['created_date']);
 $album_file_path_tn = $album_file_path . '_tn' . DIRECTORY_SEPARATOR;
 $album_file_path .= DIRECTORY_SEPARATOR;
 if (!is_dir(AT_PA_CONTENT_DIR . $album_file_path)) {
     mkdir(AT_PA_CONTENT_DIR . $album_file_path);
 }
 if (!is_dir(AT_PA_CONTENT_DIR . $album_file_path_tn)) {
     mkdir(AT_PA_CONTENT_DIR . $album_file_path_tn);
 }
 //add the photo
 $added_photo_id = $pa->addPhoto($_FILES['photo']['name'], $_POST['photo_comment'], $_SESSION['member_id']);
 if ($added_photo_id <= 0) {
     $msg->addError('PA_ADD_PHOTO_FAILED');
 }
 if (!$msg->containsErrors()) {
     //get photo filepath
     $photo_info = $pa->getPhotoInfo($added_photo_id);
     $photo_file_path = getPhotoFilePath($added_photo_id, $_FILES['photo']['name'], $photo_info['created_date']);
     //resize images to a specific size, and its thumbnail
     $si = new SimpleImage();
     $si->load($_FILES['photo']['tmp_name']);
     $image_w = $si->getWidth();
     $image_h = $si->getHeight();
     //picture is horizontal
     if ($image_w > $image_h) {
         //don't stretch images
예제 #2
0
 if (!isset($visible_albums[$aid]) && $album_info['permission'] == AT_PA_PRIVATE_ALBUM) {
     //TODO msg;
     $msg->addError("ACCESS_DENIED");
     header('location: index.php');
     exit;
 }
 // get the current photo info, and paths
 $album_file_path = getAlbumFilePath($album_info['id'], $album_info['created_date']);
 $album_file_path_tn = $album_file_path . '_tn' . DIRECTORY_SEPARATOR;
 $album_file_path .= DIRECTORY_SEPARATOR;
 $photo_file_path = getPhotoFilePath($photo_info['id'], $photo_info['name'], $photo_info['created_date']);
 $photo_location = AT_PA_CONTENT_DIR . $album_file_path . $photo_file_path;
 $photo_tn_location = AT_PA_CONTENT_DIR . $album_file_path_tn . $photo_file_path;
 if ($aid != $profile_aid) {
     // now, get the new photo info, and path
     $pa_profile->addPhoto($photo_info['name'], $photo_info['description'], $_SESSION['member_id']);
     $album_info_new = $pa_profile->getAlbumInfo();
     $album_file_path_new = getAlbumFilePath($album_info_new['id'], $album_info_new['created_date']);
     $album_file_path_tn_new = $album_file_path_new . '_tn' . DIRECTORY_SEPARATOR;
     $album_file_path_new .= DIRECTORY_SEPARATOR;
     $added_photo_id = mysql_insert_id();
     $photo_info_new = $pa->getPhotoInfo($added_photo_id);
     $photo_file_path_new = getPhotoFilePath($added_photo_id, $photo_info_new['name'], $photo_info_new['created_date']);
     $photo_location_new = AT_PA_CONTENT_DIR . $album_file_path_new . $photo_file_path_new;
     $photo_tn_location_new = AT_PA_CONTENT_DIR . $album_file_path_tn_new . $photo_file_path_new;
     // if directory does not exist, create it.
     if (!is_dir(AT_PA_CONTENT_DIR . $album_file_path_new)) {
         mkdir(AT_PA_CONTENT_DIR . $album_file_path_new);
     }
     if (!is_dir(AT_PA_CONTENT_DIR . $album_file_path_tn_new)) {
         mkdir(AT_PA_CONTENT_DIR . $album_file_path_tn_new);