Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function _copy_to ($album_id, $item) {
- $album_to = ORM::factory("item", $album_id);
- $album_from = ORM::factory("item", $item->parent_id);
- $to_dir = str_replace(dirname($album_to->file_path()), "", $album_to->file_path());
- $from_dir = str_replace(dirname($album_from->file_path()), "", $album_from->file_path());
- $from = $item->file_path();
- $to = str_replace($from_dir, $to_dir, $item->file_path());
- $to_original = $to;
- copy($from, $to);
- chmod($to, 0777);
- $from = str_replace("albums", "thumbs", $from);
- $to = str_replace("albums", "thumbs", $to);
- copy($from, $to);
- chmod($to, 0777);
- $from = str_replace("thumbs", "resizes", $from);
- $to = str_replace("thumbs", "resizes", $to);
- copy($from, $to);
- chmod($to, 0777);
- $copy = ORM::factory("item");
- $copy->name = $item->name;
- $copy->title = $item->title;
- $copy->type = $item->type;
- $copy->parent_id = $album_to->id;
- $copy->set_data_file($to_original);
- $copy->save();
- }
Advertisement
Add Comment
Please, Sign In to add comment