F
Filament16mo ago
vitsw

fileupload state, after resizing an image using imageeditor, has multiple TemporaryUploadedFile's

Hi! Is it by design or am I missing something? For instance, when I upload a file using FileUpload field and after that resize the image using imageEditor, I get an array of original and modified image in the state. Why previous image is not deleted?
5 Replies
awcodes
awcodes16mo ago
Because they both exist in tmp storage and the image(s) aren’t actually processed until persisting the record. Also allows you to save both images so that the edited version isn’t destructive.
alexanderkroneis
alexanderkroneis16mo ago
I noticed this too last week. Might be nice to add a flag to the upload to control this actively. ->keepOriginal() or something similar, if it doesn't exist yet.
awcodes
awcodes16mo ago
Not entirely a bad idea. I think there’s an open issue around this too.
vitsw
vitswOP16mo ago
In my case I have a problem about this, because I do validation on image aspect ratio and it seems that FileUpload component always gets original image instead of resized images.
alexanderkroneis
alexanderkroneis16mo ago
I opened the issues page on GitHub so I remember. I might put some work into this next week. 🤔

Did you find this page helpful?