SHOW:
|
|
- or go back to the newest paste.
| 1 | function _copy_to ($album_id, $item) {
| |
| 2 | $album_to = ORM::factory("item", $album_id);
| |
| 3 | $album_from = ORM::factory("item", $item->parent_id);
| |
| 4 | ||
| 5 | $to_dir = str_replace(dirname($album_to->file_path()), "", $album_to->file_path()); | |
| 6 | $from_dir = str_replace(dirname($album_from->file_path()), "", $album_from->file_path()); | |
| 7 | ||
| 8 | $from = $item->file_path(); | |
| 9 | $to = str_replace($from_dir, $to_dir, $item->file_path()); | |
| 10 | $to_original = $to; | |
| 11 | copy($from, $to); | |
| 12 | chmod($to, 0777); | |
| 13 | ||
| 14 | $from = str_replace("albums", "thumbs", $from);
| |
| 15 | $to = str_replace("albums", "thumbs", $to);
| |
| 16 | copy($from, $to); | |
| 17 | chmod($to, 0777); | |
| 18 | ||
| 19 | $from = str_replace("thumbs", "resizes", $from);
| |
| 20 | $to = str_replace("thumbs", "resizes", $to);
| |
| 21 | copy($from, $to); | |
| 22 | chmod($to, 0777); | |
| 23 | ||
| 24 | $copy = ORM::factory("item");
| |
| 25 | $copy->name = $item->name; | |
| 26 | $copy->title = $item->title; | |
| 27 | $copy->type = $item->type; | |
| 28 | - | $copy->thumb_with= $item->thumb_with; |
| 28 | + | |
| 29 | - | $copy->thumb_height= $item->thumb_height; |
| 29 | + | |
| 30 | $copy->save(); | |
| 31 | ||
| 32 | } |