public function deleteData($id, $section_start) { $ids = array(); $this->data_item->buildDelete($id, $ids, $section_start); if (sizeof($ids) > 0) { $ids_string = '(' . implode(',', $ids) . ')'; $images = $this->data_item->getImageFilenames($ids_string); $videos = $this->data_item->getVideoFilenames($ids_string); $all_files = array(); if (sizeof($videos) > 0) { // take care of video thumbnails $all_videos = array(); foreach ($videos as $video) { array_push($all_videos, $video); array_push($all_videos, $video . '.jpg'); } $all_files = array_merge($all_videos, $images); } else { $all_files = $images; } $images_removed = false; if (sizeof($all_files) > 0) { $u = new ImageUpload('data', false, array()); $images_removed = $u->remove($all_files); } if (sizeof($images) < 1 || $images_removed) { $this->data_item->doDelete($ids_string); } } }
public function remove_image() { if (!isset($_GET['id']) || !is_numeric($_GET['id'])) { $_GET['id'] = 0; } $i = Model::load('BlogImage'); $i->id = $_GET['id']; $i->load(); $u = new ImageUpload('blog', false, array()); if ($u->remove(array($i->filename))) { $i->delete(); } $this->redirect('admin/blog/view/' . $i->blog_id); }
public function update_image_sizes() { $i = Model::load('ImageSize'); $i->id = $_GET['id']; $i->load(); $images = $i->getDataFiles(); $d = array(array($i->prefix . '_', $i->width, $i->height)); $u = new ImageUpload('', false, $d); set_time_limit(300); $u->resize($images); $this->redirect('admin/dsection/image_sizes'); }