/** * Delete image */ function handleDeleteImage($id) { $this->database->table("media")->get($id)->delete(); \App\Model\IO::remove(APP_DIR . '/media/' . $id . '/' . $this->getParameter("name")); \App\Model\IO::remove(APP_DIR . '/media/' . $id . '/tn/' . $this->getParameter("name")); $this->redirect(":Admin:Pages:detailImages", array("id" => $this->getParameter("name"))); }
function handleDeletePortrait() { $idfFolder = substr(__DIR__, 0, -27) . '/www'; if (file_exists($idfFolder . "/images/profiles/portrait-" . $this->user->getId() . ".jpg")) { \App\Model\IO::remove($idfFolder . "/images/profiles/portrait-" . $this->user->getId() . ".jpg"); } $this->redirect(this); }
/** * Delete image */ function handleDelete($id, $type) { $imageDb = $this->database->table("media")->get($id); \App\Model\IO::remove(APP_DIR . '/media/' . $imageDb->pages_id . '/' . $imageDb->name); \App\Model\IO::remove(APP_DIR . '/media/' . $imageDb->pages_id . '/tn/' . $imageDb->name); $imageDb->delete(); $this->redirect(":Admin:Media:default", array("id" => $imageDb->pages_id, "type" => $this->getParameter("type"))); }
/** * Delete image */ function handleDelete($id) { $imageDb = $this->database->table("media")->get($this->getParameter("name")); $imageDb->delete(); \App\Model\IO::remove(APP_DIR . '/media/' . $id . '/' . $imageDb->name); \App\Model\IO::remove(APP_DIR . '/media/' . $id . '/tn/' . $imageDb->name); $this->redirect(this, array("id" => $this->presenter->getParameter("name"))); }
function handleDelete($id) { for ($a = 0; $a < count($id); $a++) { $product = $this->database->table("carousel")->get($id[$a]); $image = $product->image; $product->delete(); Model\IO::remove(APP_DIR . '/images/carousel/' . $image); unset($image); } $this->redirect(":Admin:Appearance:carousel", array("id" => null)); }
function changePortraitFormSucceeded(\Nette\Forms\BootstrapUIForm $form) { // TODO peekay support for more types of images or image convertor $membersDb = $this->database->table("users")->where(array("id" => $this->presenter->user->getId())); if ($membersDb->count() > 0) { $uid = $membersDb->fetch()->id; if (file_exists(APP_DIR . '/images/profiles/portrait-' . $uid . '.jpg')) { \App\Model\IO::remove(APP_DIR . '/images/profiles/portrait-' . $uid . '.jpg'); \App\Model\IO::upload(APP_DIR . '/images/profiles/', 'portrait-' . $uid . '.jpg'); } else { \App\Model\IO::upload(APP_DIR . '/images/profiles/', 'portrait-' . $uid . '.jpg'); } } $this->presenter->redirect(":Front:Profile:image"); }
public function editFormSucceeded(\Nette\Forms\BootstrapUIForm $form) { $image = $form->values->the_file->name; $arr = array("title" => $form->values->title, "description" => $form->values->description, "uri" => $form->values->uri, "visible" => $form->values->visible); if ($form->values->the_file->error == 0) { $arr['image'] = $image; if (file_exists(APP_DIR . "/images/carousel/" . $image)) { \App\Model\IO::remove(APP_DIR . "/images/carousel/" . $image); \App\Model\IO::upload(APP_DIR . "/images/carousel/", $image); } else { \App\Model\IO::upload(APP_DIR . "/images/carousel/", $image); } } $this->database->table("carousel")->get($form->values->carousel_id)->update($arr); $this->redirect(this, array("carousel_id" => $form->values->carousel_id)); }
function editSettingsSucceeded(\Nette\Forms\BootstrapUIForm $form) { if (strlen($form->values->path->name) < 1) { $this->presenter->redirect(this, array("id" => null)); } if (file_exists($_FILES['path']['tmp_name']) || is_uploaded_file($_FILES['path']['tmp_name'])) { copy($_FILES['path']['tmp_name'], APP_DIR . '/images/paths/' . $form->values->path->name); chmod(APP_DIR . '/images/paths/' . $form->values->path->name, 0644); chmod(APP_DIR . '/images/paths/' . $form->values->path->name, 0644); if (file_exists(APP_DIR . '/www/images/paths/' . $form->values->path->name)) { \App\Model\IO::remove(APP_DIR . '/www/images/paths/' . $form->values->path->name); } $this->database->table("settings")->get($form->values->path_id)->update(array("setvalue" => $form->values->path->name)); } $this->redirect(this, array("id" => null)); }
function uploadFormSucceeded(\Nette\Forms\BootstrapUIForm $form) { $fileDirectory = APP_DIR . '/media/' . $form->values->id; \App\Model\IO::directoryMake($fileDirectory, 0755); if (strlen($_FILES["the_file"]["tmp_name"]) > 1) { $imageExists = $this->database->table("media")->where(array('name' => $_FILES["the_file"]["name"], 'pages_id' => $form->values->id)); $fileName = $fileDirectory . '/' . $_FILES["the_file"]["name"]; \App\Model\IO::remove($fileName); copy($_FILES["the_file"]["tmp_name"], $fileName); chmod($fileName, 0644); if ($imageExists->count() == 0) { $this->database->table("media")->insert(array('name' => $_FILES["the_file"]["name"], 'pages_id' => $form->values->id, 'description' => $form->values->description, 'filesize' => filesize($fileDirectory . '/' . $_FILES["the_file"]["name"]), 'file_type' => 1, 'date_created' => date("Y-m-d H:i:s"))); } // thumbnails $image = \Nette\Utils\Image::fromFile($fileName); $image->resize(400, 250, \Nette\Utils\Image::SHRINK_ONLY); $image->sharpen(); $image->save(APP_DIR . '/media/' . $form->values->id . '/tn/' . $_FILES["the_file"]["name"]); chmod(APP_DIR . '/media/' . $form->values->id . '/tn/' . $_FILES["the_file"]["name"], 0644); } $this->redirect(this, array("id" => $form->values->id, "category" => $form->values->category)); }
/** * Delete file */ function handleDeleteFile($id) { $this->database->table("media")->get($id)->delete(); \App\Model\IO::remove(APP_DIR . '/media/' . $id . '/' . $this->getParameter("name")); $this->onSave($this->getParameter("name")); }
/** * Delete files */ function handleDelete() { Model\IO::remove(APP_DIR . '/images/' . $this->getParameter("path")); $this->redirect(this); }
/** * Delete image */ function handleDeleteImage($id) { $type = $this->getParameter("type"); \App\Model\IO::remove(APP_DIR . '/images/menu/' . $id . $type . '.png'); $this->redirect(":Admin:Menu:detail", array("id" => $id)); }