matriphe/laravel-imageupload

How to delete images

Closed this issue · 2 comments

I want to delete images when delete row product, this library is not supported?

@phamvansy This package is only for uploading and manipulating the image. Once the image has been uploaded, you would handle the deleting of that image the same way you would handle any other file asset that has been uploaded to the server. If you want to have the image deleted automatically when you delete the product that it is associated, you would need to create an Event (https://laravel.com/docs/5.6/events) that is fires when you delete the product (see https://laravel.com/docs/5.6/eloquent#events). Within this event's listener, you would place your code to delete the associated image.

@deanlaw is right. this package only provides way for uploading and resizing image. It still doesn't support deletion. I'm afraid you have to delete the image manually.

If you have idea about how to automate this, I'm open for PR.