process() access image dimension information after resizing
See original GitHub issueMy goal in using filepond was simply to get uploaded images into some reasonably scaled state via compression and resizing before uploading to an s3 transfer accelerated bucket and transferring to their final destination (when they’re queued for additional processing, etc). All is working here for us except that I can’t seem to determine where on earth the finished file dimensions are after combing through the documentation.
I am uploading an image using my own “process” function and noticed that the metadata argument has incorrect values for width and height given these settings which leads me to believe metadata is actually just information about my settings that I already know given:
imageResizeTargetWidth=1920 imageResizeUpscale=false imageResizeMode=contain
We expected to see the resulting width and height in the metadata object. Given an jpeg that measures 5184x3456 here is the metadata object as passed to my process() function as instructed:
process(fieldName, file, metadata, load, error, progress, abort, transfer, options) { ... }
{
"resize": {
"mode": "contain",
"upscale": false,
"size": {
"width": 1920,
"height": 1920
}
},
"color": null,
"output": {
"type": null,
"quality": null,
"client": [
"crop",
"resize",
"filter",
"markup",
"output"
]
}
}
Expected metadata.resize.size.height to equal it’s processed which in this case is 1280.
Versions:
{"filepond": "^4.20.1",
"filepond-plugin-file-validate-type": "^1.2.5",
"filepond-plugin-image-preview": "^4.6.4",
"filepond-plugin-image-resize": "^2.0.7",
"filepond-plugin-image-transform": "^3.7.4"}
Issue Analytics
- State:
- Created 3 years ago
- Comments:8
Gotcha! Thanks, I like Doka and will probably get a license at some point in time, but until then I will stick with my current code. Or change it if you decide to make a plugin for it!
@rikschennink can you make the uploaded image dimensions accessible in the file object? https://pqina.nl/filepond/docs/patterns/api/file/
The use case here is we want to put the uploaded image onto another
<img>
element and set it’s dimension to the uploaded image.