[Feature] Server process endpoint - allow server sided image transformation
Is there an existing issue for this?
- I have searched the existing issues
Is your feature request related to a problem? Please describe.
iPhone / iPad devices are defaulting to the HEIC file format. At the server in Php, a transformation from HEIC to JPG can be done, using the extension Imagick. But the transformed image can not be returned to Filepond using https://pqina.nl/filepond/docs/api/server/#process . The Filepond preview can not pick up the server transformed image at the moment.
The server side is explicitly choosen, so the not so powerful mobile device is not burdened with such an image transformation in javascript.
Describe the solution you'd like
The https://pqina.nl/filepond/docs/api/server/#process documentation describes:
- FilePond uploads file my-file.jpg as multipart/form-data using a POST request
- server saves file to unique location tmp/12345/my-file.jpg
- server returns unique location id 12345 in text/plain response
- FilePond stores unique id 12345 in a hidden input field
- client submits the FilePond parent form containing the hidden input field with the unique id
- server uses the unique id to move tmp/12345/my-file.jpg to its final location and remove the tmp/12345 folder
This feature request is about part 3 server returns unique location id 12345 in text/plain response. Adjust this to allow the server to return a transformed image/jpeg response, and a HTTP header containing the unique id.
e.g. The server returns a Http response containing:
- Content-Type: image/jpeg
- additional http response header X-Filepond-Id: 12345
- Body: the jpeg bytes.
Such a transformation would replace the image in Filepond preview.
Describe alternatives you've considered
- Creating a transform like https://v5.filepond.com/docs/reference/filepond/create-transform-extension/
This is the path I'm going to follow for now. But it would be much easier if the server could just return the transformed image.
- Using the advanced https://pqina.nl/filepond/docs/api/server/#process-1
Doing the post of the HEIC image myself. Parsing the server response myself into an image/jpeg and unique id. And then somehow instruct Filepond to use the transformed image/jpeg.
Source: pqina/filepond