mirror of
https://github.com/Pathduck/gallery3.git
synced 2026-04-09 23:45:56 -04:00
Allow server-side adding of images to other albums than the root
This commit is contained in:
@@ -190,11 +190,17 @@ class Welcome_Controller extends Template_Controller {
|
||||
|
||||
function add_photos() {
|
||||
$path = $this->input->post("path");
|
||||
$parent_id = (int)$this->input->post("parent_id");
|
||||
$parent = ORM::factory("item", $parent_id);
|
||||
if (!$parent->loaded) {
|
||||
throw new Exception("@todo BAD_ALBUM");
|
||||
}
|
||||
|
||||
cookie::set("add_photos_path", $path);
|
||||
|
||||
foreach (glob("$path/*.[Jj][Pp][Gg]") as $file) {
|
||||
set_time_limit(30);
|
||||
photo::create(1, $file, basename($file), basename($file));
|
||||
photo::create($parent->id, $file, basename($file), basename($file));
|
||||
}
|
||||
url::redirect("welcome");
|
||||
}
|
||||
|
||||
@@ -268,6 +268,8 @@
|
||||
<input type="submit" value="upload"/>
|
||||
<input type="text" name="path" size="70"
|
||||
value="<?= cookie::get("add_photos_path") ?>" />
|
||||
<br>
|
||||
Album id: <input name="parent_id" type="text" size="3" value="1"/>
|
||||
</form>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
|
||||
Reference in New Issue
Block a user