F
Filament11mo ago
daar

Resize image in SpatieMediaLibraryFileUpload

Hello, I find Spatie's package excellent, especially for defining conversions to resize uploaded images. However, I'm wondering if there's a way to convert the original file before it gets placed on the server, thus skipping the conversions. The issue is that the original file remains publicly accessible, and I'd like to prevent that. Regards, Darius
7 Replies
krekas
krekas11mo ago
have you checked media library docs?
daar
daarOP11mo ago
I did, did I overlook anything? As mentioned, the conversions are clearly specified in the docs. But these create a subfolder called conversions with the originally uploaded image file in the root. I would not want the root image to be created, but rather only the conversions.
krekas
krekas11mo ago
doesn't seem that's posible
daar
daarOP11mo ago
I was hoping for some sort of a beforeSave method or perhaps via an observer Does FileUpload allow this?
krekas
krekas11mo ago
if manually then you could delete file
SLy
SLy11mo ago
Not optimal, but you can a write model trait that cleans the root files on save.
krekas
krekas11mo ago
observer in the model one way
Want results from more Discord servers?
Add your server