/** * Delete all files on disk for the given file in storage * This means the original and the thumbnails * @param $file * @return bool */ public function deleteAllFor(File $file) { if (!$this->isImage($file->path)) { return $this->finder->delete($file->path); } $paths[] = public_path() . $file->path; $fileName = pathinfo($file->path, PATHINFO_FILENAME); $extension = pathinfo($file->path, PATHINFO_EXTENSION); foreach ($this->manager->all() as $thumbnail) { $paths[] = public_path() . $this->config->get('asgard.media.config.files-path') . "{$fileName}_{$thumbnail->name()}.{$extension}"; } return $this->finder->delete($paths); }
/** * Delete all files on disk for the given file in storage * This means the original and the thumbnails * @param $file * @return bool */ public function deleteAllFor(File $file) { if (!$this->isImage($file->path)) { return $this->filesystem->disk($this->getConfiguredFilesystem())->delete($file->path->getRelativeUrl()); } $paths[] = $file->path->getRelativeUrl(); $fileName = pathinfo($file->path, PATHINFO_FILENAME); $extension = pathinfo($file->path, PATHINFO_EXTENSION); foreach ($this->manager->all() as $thumbnail) { $path = config('asgard.media.config.files-path') . "{$fileName}_{$thumbnail->name()}.{$extension}"; $paths[] = (new MediaPath($path))->getRelativeUrl(); } return $this->filesystem->disk($this->getConfiguredFilesystem())->delete($paths); }
/** * A grid view of uploaded files used for the wysiwyg editor * @return \Illuminate\View\View */ public function ckIndex() { $files = $this->file->all(); $thumbnails = $this->thumbnailsManager->all(); return view('media::admin.grid.ckeditor', compact('files', 'thumbnails')); }
/** * Show the form for editing the specified resource. * * @param File $file * @return Response */ public function edit(File $file) { Breadcrumbs::addCrumb(trans('media::media.title.edit media')); $thumbnails = $this->thumbnailsManager->all(); return view('media::admin.edit', compact('file', 'thumbnails')); }
/** * Show the form for editing the specified resource. * * @param File $file * @return Response */ public function edit(File $file) { $thumbnails = $this->thumbnailsManager->all(); return view('media::admin.edit', compact('file', 'thumbnails')); }