Laravel-medialibrary: I'd like to be able to delete the original upload, leaving the conversions

Created on 29 Oct 2017  路  3Comments  路  Source: spatie/laravel-medialibrary

Is this possible? I store two sizes suitable to display on the site, but I don't need to keep the user's 4000 pixel original.

I know I could get the path and unlink the file but not sure what implications this would have. I don't plan to allow conversions to be regenerated.

Most helpful comment

The package doesn't do this for you, but you can manually delete the original file with

unlink($media->getPath());

All 3 comments

The package doesn't do this for you, but you can manually delete the original file with

unlink($media->getPath());

@snapey have u found an automated way for doing that ?

If using s3 or local
Illuminate\Support\Facades\Storage\Storage::disk($media->disk)->delete($media->getPath());

Was this page helpful?
0 / 5 - 0 ratings

Related issues

netanelwebninja picture netanelwebninja  路  3Comments

aaronfullerton picture aaronfullerton  路  4Comments

stayallive picture stayallive  路  4Comments

whdckszxxx picture whdckszxxx  路  4Comments

intrepidws picture intrepidws  路  3Comments