Remove the specified photo from storage.

@param Photo $photo
@return Response
766873
public function destroy(Photo $photo)
    {
        $this->deleteEntry($photo, request());

        log_activity('Photo Deleted', 'A Photo was successfully deleted', $photo);

        return redirect_to_resource();
    }
1302513
public function add($photo)
    {
        if (is_array($photo)) {
            $this->collection[] = new Photo($photo);
        } elseif (is_object($photo) && $photo instanceof Photo) {
            $this->collection[] = $photo;
        }

        return $this;
    }
957130
public function postDeletePhoto(Request $request)
    {
        if (session()->has('photos')) {
            $photos = session('photos');

            foreach ($photos as $index => $photo) {
                if (in_array($request->input('file'), $photo)) {
                    $photo = Photo::find($photo['photo_id']);

                    $photo->delete();

                    unset($photos[$index]);

                    session('photos', $photos);

                    return response('', 200);
                }
            }
        }

        return response('', 400);
    }
477400
public function submitDelete($file)
    {
        AdminLog::new_log('Removed ' . $file . ' from Gallery (ID ' . $this->_block->id . ')');
        $galleryData = $this->_defaultData($this->_block->getContent());
        $path = '/' . $this->_block->getPageId() . '/';
        if (isset($galleryData[$file])) {
            $path = $galleryData[$file]->path;
            unset($galleryData[$file]);
            $this->_block->updateContent(serialize($galleryData));
        }
        $fullDir = public_path() . '/uploads/system/gallery/' . $this->_block->name . $path;
        if (file_exists($fullDir . 'thumbnail/' . $file)) {
            unlink($fullDir . 'thumbnail/' . $file);
        }
        if (file_exists($fullDir . $file)) {
            unlink($fullDir . $file);
        }
        return 1;
    }
1317796
public function doRemoveCroppableImage()
    {
        if ($image      =   SaltedCroppableImage::get()->byID($this->value)) {
            $image->delete();
        }

        $this->setValue('');
        return $this->FieldHolder();
    }
282895
public void removePhoto(String photosetId, String photoId) throws FlickrException {
        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("method", METHOD_REMOVE_PHOTO);

        parameters.put("photoset_id", photosetId);
        parameters.put("photo_id", photoId);

        Response response = transportAPI.post(transportAPI.getPath(), parameters, apiKey, sharedSecret);
        if (response.isError()) {
            throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
        }
    }
795881
public void delete(String photoId) throws FlickrException {
        Map<String, Object> parameters = new HashMap<String, Object>();
        parameters.put("method", METHOD_DELETE);

        parameters.put("photo_id", photoId);

        // Note: This method requires an HTTP POST request.
        Response response = transport.post(transport.getPath(), parameters, apiKey, sharedSecret);
        if (response.isError()) {
            throw new FlickrException(response.getErrorCode(), response.getErrorMessage());
        }
        // This method has no specific response - It returns an empty
        // sucess response if it completes without error.
    }
260044
public function destroy(Request $request, Album $album)
	{
		$this->authorize('admin',  Auth::user());
		
		if($album->resources()->count() > 0) return redirect(route('albumes'))->with('error', 'Es necesario borrar los resources first');
		
		$album->delete();
	
		return redirect(route('albumes'))->with('success', 'Profile Deleted!');
	}
740403
public function deleteImage(EventInterface $event) {
        $request = $event->getRequest();
        $event->getStorage()->delete($request->getUser(), $request->getImageIdentifier());
    }
1205840
public function add($photo)
    {
        if (is_array($photo)) {
            $this->collection[] = new OfferPhoto($photo);
        } elseif (is_object($photo) && $photo instanceof OfferPhoto) {
            $this->collection[] = $photo;
        }

        return $this;
    }
580577
protected function _actionRemovephoto($context)
    {
        $lastPhoto = ($this->getItem()->photos->getTotal() > 1) ? false : true;
        $this->getItem()->removePhoto($this->photo);

        if ($lastPhoto) {
            $this->getResponse()->status = 204;

            return;
        } else {
            return $this->getItem();
        }
    }
84487
public function actionDeleteImage(): Response
    {
        $model = $this->findModel($this->attachmentModelClass, Yii::$app->request->post('id'));

        $model->delete();

        return $this->asJson([
            'status' => 'success',
        ]);
    }
884746
def photo_post_delete_handler(sender, **kwargs):
    ''''''
    instance = kwargs.get('instance')
    instance.master.delete(save=False)
    instance.delete_all_renditions()
474529
protected function thumbnails($photo, $photoKey, $path, $request)
    {
        $this->makeDirectoryBeforeUpload($path, false);
        $photos = [];
        $thumbnails = isset($this->options['changeThumb'])
            ? $this->options['thumbnails'][$this->options['changeThumb']]
            : $this->options['thumbnails'];
        foreach ($thumbnails as $name => $thumb) {
            $thumb_path = $path . '/' . $name . '_' . $this->fileName;
            $this->image = Image::make( $photo )
                ->encode('jpg');

            $this->resizeImage($request, $photoKey, $thumb);
            $this->image->save($thumb_path, 100);
            $photos[$name] = '/' . $thumb_path;
        }
        return $photos;
    }
527768
def remove(image):
    """"""
    path = os.path.join(IMG_DIR, image)
    if os.path.isfile(path):
        os.remove(path)
128510
public function destroy()
    {
        if ($this->resource) {
            imagedestroy($this->resource);
        }

        $this->resource = null;

        return $this;
    }
1133017
def replace(self, photo, photo_file, **kwds):
        
        with open(photo_file, 'rb') as in_file:
            result = self._client.post("/photo/%s/replace.json" %
                                       self._extract_id(photo),
                                       files={'photo': in_file},
                                       **kwds)["result"]
        return Photo(self._client, result)