$new_path = '../' . DIR_COMICS_IMG . '/' . $serial; mkdir($new_path); $success = rename($import_path . '/' . $folder . '/' . $this_file, $new_path . '/' . $this_file); } else { $success = false; $total_success = false; $alert_output = $message->alert_dialog('I couldn’t import all of the new images. Looks like a permissions error. Please temporarily set the folders in /import to 777.'); } if ($success) { // Create the image DB record. $new_image_id = $comic_image->createImageRecord('/' . DIR_COMICS_IMG . $serial . '/' . $this_file); // Create the page DB record. $title = explode('.', $this_file); $title = $title[0]; if ($first_page === true) { $new_page_id = $comic_image->createPageRecord($title, $last_page + $i, $book_id, $new_marker_id); $first_page = false; } else { $new_page_id = $comic_image->createPageRecord($title, $last_page + $i, $book_id); } // Assign the image to the page. if ($new_image_id && $new_page_id) { $new_assignment_id = $comic_image->assignImageToPage($new_image_id, $new_page_id); } $i += 0.0001; } elseif ($success !== false) { $total_success = false; $alert_output .= $message->alert_dialog('I couldn’t import images from ' . $folder . '.'); } } }
$new_order = $_POST['new_order']; $new_order ? $new_order : ($new_order = 1); if ($files_uploaded) { $i = -1; $qty = count($_FILES['file']['name']); foreach ($files_uploaded as $key => $val) { $title = explode('.', $val); $title = $title[0]; if (strpos($title, '/')) { $title = explode('/', $title); $title = $title[1]; } // Create the image DB record. $new_image_id = $comic_image->createImageRecord(DIR_COMICS_IMG . '/' . $val); // Create the page DB record. $new_page_id = $comic_image->createPageRecord($title, $new_order + $i, $book_id); $first_page_id ? null : ($first_page_id = $new_page_id); // Assign the image to the page. if ($new_image_id && $new_page_id) { $new_assignment_id = $comic_image->assignImageToPage($new_image_id, $new_page_id); } $i += 0.0001; } reset_page_order($book_id, $db); header('location:book.view.php'); } } else { $alert_output .= $message->alert_dialog('Yeah, look, I can’t put files in the ' . DIR_COMICS_IMG . ' folder on your web host.'); } } if ($_POST && $_FILES['file']['name']['0'] == '') {