Handles delete image. Returns exception instance on error.

@param string $fileName
@param string $context
@param string $storage

@return mixed
765480
public static function deleteImage($fileName, $context, $storage = 'local')
    {
        /** @var Processor $processor */
        $processor = app('icr.processor');

        return $processor->delete($fileName, $context, Facades\Storage::disk($storage));
    }
1195291
public static function forget(string $key, string $storage = 'global'): void
    {
        $fileKey = self::key($key);
        if (self::has($key)) {
            @unlink(self::$path . '/' . $storage . '/' . $fileKey);
        }
    }
724274
def file_delete(context, id, file_id):
    
    dci_file.delete(context, id=file_id)
    result = dci_file.delete(context, id=file_id)
    utils.format_output(result, context.format)
167847
private boolean deleteFile(String filename) throws Exception {
        if (filename == null) {
            return false;
        }
        File file = new File(storeDir, filename);
        return Files.deleteIfExists(file.toPath());
    }
873216
public function copyFile($fileName, $storageName = '', $newDest)
    {
        //check whether file is set or not
        if ($fileName == '' || $newDest == '') {
            AsposeApp::getLogger()->error(Exception::MSG_NO_FILENAME);
            throw new Exception(Exception::MSG_NO_FILENAME);
        }

        //build URI
        $strURI = $this->strURIFile . $fileName . '?newdest=' . $newDest;
        if ($storageName != '') {
            $strURI .= '&storage=' . $storageName;
        }

        //sign URI
        $signedURI = Utils::sign($strURI);

        $responseStream = Utils::processCommand($signedURI, 'PUT', '', '');
        $json = json_decode($responseStream);

        if ($json->Code === 200) {
            return true;
        }

        return false;
    }
899186
public function delete($filename)
    {

        $dirname  = pathinfo($filename, PATHINFO_DIRNAME);
        $basename = pathinfo($filename, PATHINFO_BASENAME);

        $file_name = substr($basename, 0, strrpos($basename, '.'));

        $files = $this->storage->files($dirname);

        foreach ($files as $value) {
            $value_basename = pathinfo($value, PATHINFO_BASENAME);
            $name           = substr($value_basename, 0, strrpos($value_basename, '-'));

            if ($name == $file_name) {
                $this->storage->delete($value);
            }
        }

    }
272791
public function deleteFile($filename)
    {
        if (!file_exists($this->absolutizePath($filename))) {
            \PHPUnit\Framework\Assert::fail('file not found');
        }
        unlink($this->absolutizePath($filename));
    }
429375
public function deleteFile($containerName, $filePath, $relativePath)
    {
        return $this->getFactory()
            ->createStorage($containerName)
            ->deleteFile($containerName, $filePath, $relativePath);
    }
307657
protected function deleteFile(Request $request)
    {
        try {
            $file = $request->input('s');
            Storage::delete($file);

            return $this->notifySuccess($file . ' successfully deleted!');
        } catch (\ErrorException $e) {
            return $this->notifyError($e->getMessage());
        }
    }
550237
public function deleteFile($containerName, $fileName, $relativePath)
    {
        $fullFileName = $this->getFullFileName($containerName, $fileName, $relativePath);

        return $this->filesystem->delete($fullFileName);
    }
787844
public function handleUpload(\Illuminate\Http\Request $request, $fieldname = 'photo', $folder = 'images', $storage_disk = 'public', $randomize = true){
        if(is_null($request->file($fieldname)) || !$request->file($fieldname)->isValid()){
            throw new \Exception(trans('crud.invalid_file_upload'));
        }
        //Get filename
        $basename = basename($request->file($fieldname)->getClientOriginalName(),'.'.$request->file($fieldname)->getClientOriginalExtension());
        if($randomize){
            $filename = uniqid().'_'.str_slug($basename).'.'.$request->file($fieldname)->getClientOriginalExtension();
        }
        else{
            $filename = str_slug($basename).'.'.$request->file($fieldname)->getClientOriginalExtension();
        }
        //Move file to location
        $request->file($fieldname)->storeAs($folder,$filename,$storage_disk);
        return $filename;
    }
1288053
public function deleteFile()
    {
        if ($this->file) {
            if (file_exists($this->file)) {
                if (false === @unlink($this->file)) {
                    throw FileException::lastError();
                }
            }

            if (file_exists($this->file . '.pubkey')) {
                if (false === @unlink($this->file . '.pubkey')) {
                    throw FileException::lastError();
                }
            }

            $dir = dirname($this->file);

            if (file_exists($dir)) {
                if (false === @rmdir($dir)) {
                    throw FileException::lastError();
                }
            }

            $this->file = null;
        }
    }
156626
protected function _afterEntityDelete(AnCommandContext $context)
    {
        if (!empty($this->__sets)) {
            foreach ($this->__sets as $set) {
                if ($set->photos->getTotal() == 0) {
                    $set->delete();
                }
            }
        }
    }
149121
public function execute(StorageInterface $storage, Operations $operations)
    {
        foreach ($operations->getOperations() as $operation) {
            if ($operation instanceof AddDocumentOperation) {
                $document = $operation->getDocument();
                $event = new DocumentEvent($document);
                if ($this->eventDispatcher->dispatch(IndexerEvents::BEFORE_STORAGE_ADD_DOCUMENT, $event)
                    ->isPropagationStopped()
                ) {
                    continue;
                }

                $storage->addDocument($document);

                $event = new DocumentEvent($document);
                $this->eventDispatcher->dispatch(IndexerEvents::STORAGE_ADD_DOCUMENT, $event);
            } elseif ($operation instanceof AddIdentityOperation) {
                throw new InvalidArgumentException('Add identity command not supported by run().');
            } elseif ($operation instanceof UpdateDocumentOperation) {
                $document = $operation->getDocument();
                $event = new DocumentEvent($document);
                if ($this->eventDispatcher->dispatch(IndexerEvents::BEFORE_STORAGE_UPDATE_DOCUMENT, $event)->isPropagationStopped()) {
                    continue;
                }

                $storage->updateDocument($document);

                $event = new DocumentEvent($document);
                $this->eventDispatcher->dispatch(IndexerEvents::STORAGE_UPDATE_DOCUMENT, $event);
            } elseif ($operation instanceof UpdateIdentityOperation) {
                throw new InvalidArgumentException('Update identity command not supported by run().');
            } elseif ($operation instanceof DeleteDocumentOperation) {
                $storage->deleteDocument($operation->getDocument());
            } elseif ($operation instanceof DeleteIdentityOperation) {
                $storage->delete($operation->getIdentity());
            } elseif ($operation instanceof DeleteTypeOperation) {
                $storage->deleteType($operation->getType());
            } elseif ($operation instanceof DeleteAllOperation) {
                $storage->deleteAll();
            } elseif ($operation instanceof FlushOperation) {
                if ($storage instanceof Flushable) {
                    $storage->flush();
                }
            } elseif ($operation instanceof OptimizeOperation) {
                if ($storage instanceof Optimizable) {
                    $storage->optimize();
                }
            } elseif ($operation instanceof CommitOperation) {
                if ($storage instanceof Commitable) {
                    $storage->commit();
                }
            } elseif ($operation instanceof RollbackOperation) {
                if ($storage instanceof Rollbackable) {
                    $storage->rollback();
                }
            }
        }

        return true;
    }
378269
public function thumbnailAction($storageId, $height, $width)
    {
        $fileManager = $this->get('beaast.core.manager.file');

        /**
         * @var File $file
         */
        $file = $fileManager->findOneBy(['storageId' => $storageId]);

        if (!$file || !in_array($file->getExtension(), ['jpg', 'png', 'gif'], true)) {
            throw $this->createNotFoundException();
        }

        $filePath = $fileManager->getFilePath($file);

        $cacheFileName = 'thumbnail_'.$height.'_'.$width.'_'.$storageId.'.'.$file->getExtension();

        $cacheFilePath = $this->getParameter('kernel.root_dir').'/../var/storage/cache/'.$cacheFileName;
        if (!file_exists($cacheFilePath) && file_exists($filePath)) {
            $imagick = new \Imagick($filePath);
            $imagick->thumbnailImage($width, $height, true);
            file_put_contents($cacheFilePath, $imagick->getImageBlob());
        }

        return $this->cacheAction($cacheFileName);
    }
285701
def _handle_delete_file(self, data):
        """"""

        file = self.room.filedict.get(data)
        if file:
            self.room.filedict = data, None
            self.conn.enqueue_data("delete_file", file)
861066
public function deleteFile($filename)
    {
        if (isset($this->_fileHandlers[$filename])) {
            $this->_fileHandlers[$filename]->close();
        }
        unset($this->_fileHandlers[$filename]);

        global $php_errormsg;
        $trackErrors = ini_get('track_errors'); ini_set('track_errors', '1');
        if (!@unlink($this->_dirPath . '/' . $filename)) {
            ini_set('track_errors', $trackErrors);
            include_once 'Zend/Search/Lucene/Exception.php';
            throw new Zend_Search_Lucene_Exception('Can\'t delete file: ' . $php_errormsg);
        }
        ini_set('track_errors', $trackErrors);
    }