Open mrneatly opened 3 years ago
+1 for this.
I also tried implementing my own fix for this. However, integrating with orchid's upload process is tedious for me since the functionalities are strictly tied together.
For now, what I did was create a new Field named PictureRaw
. Basically it is the same with the Picture field except that I have more control on the uploaded file.
This means that I lose access to automatic processing done by orchid (example: Attachment permission checks, auto move files to correct storage, etc.). You will have to do these stuffs by yourself which kinda kills the "rapid" development that orchid is aiming to do.
What this code do:
previewUrl(url)
. This method will display a preview image using the given url<fieldName>_isRemoved
. This input will always be added for each declaration of PictureRaw
. Basically, this just allows you to check if the user pressed the 'Remove' button when there is a value set using previewUrl
$request->file()
Anyway I haven't fully tested this with other cases, maybe @mrneatly or @tabuna may check it out in case other people also requests for it. I am also not sure if I built the laravel mix correctly. https://github.com/stonedleaf/platform/commit/da2d1b702d68803c0ce14735a7f53bf8e8486693
Still hoping orchid will have an official support for Picture
's path()
method :D
Is your feature request related to a problem? Please describe. I'm using a
Picture
field in one of my layouts and I'm pretty happy with the functionality it provides, but there is one thing I don't like about it: it puts uploaded files under automatically created subdirectories. The project I'm working on has a strictly defined structure of folders for files being uploaded and such behaviour just makes things unnecessarily harder. It would be very convenient to have a control over such things.Describe the solution you'd like A
path()
method which allows to specify a particular path on the disk I'm uploading files to. A very similar proposal was in #1106 (here to be more precise), but it got never released since then.Describe alternatives you've considered It is, of course, possible to define a custom
Generator
class in the platform's config. But it looks more like a hack in this case, because it doesn't really add new functionality but tries to fix existing instead.