fine-uploader
fine-uploader copied to clipboard
Upload success size parameter not correct for scaled images
Type of issue
- [X] Bug report
- [ ] Feature request
- [ ] Support request
Uploader type
- [ ] Traditional
- [X] S3
- [ ] Azure
Bug Report
Fine Uploader version
5.15.0
Browsers where the bug is reproducible
Chrome (though haven't tested any other browsers)
Operating systems where the bug is reproducible
IOS 10.12.6
Exact steps required to reproduce the issue
For example:
- Select 3 files
- Pause the 2nd file before it completes, but after it has started.
- Attempt to resume the paused file.
All relevant Fine Uploader-related code that you have written
Your Fine Uploader template markup (if using Fine Uploader UI and the issue is UI-related)
{simply copy and paste your template markup}
Detailed explanation of the problem
I have scaling turned on in the S3 uploader.
scaling: {
sendOriginal: true,
sizes: [
{name: 'test', maxSize: 1024}
]
}
I also have an uploadSuccess endpoint configured. The problem I am having is that the 'size' parameter of the scaled image is still the original files size, not the scaled images size.
Below are the params sent to the uploadSuccess endpoint for an uploaded file.
key:877ae779-28ae-4da0-9a20-612d7bf4c9c6.jpeg
uuid:877ae779-28ae-4da0-9a20-612d7bf4c9c6
name:Santa-2014 (test).jpeg
bucket:divvito-documents-dev
Content-Disposition:inline; filename=Santa-2014 (test).jpeg
size:2001403
type:image/jpeg
qqparentuuid:78ea76bb-b195-4a62-8fb6-fa5510cd0928
qqparentsize:2001403
qquuid:877ae779-28ae-4da0-9a20-612d7bf4c9c6
key:78ea76bb-b195-4a62-8fb6-fa5510cd0928.jpeg
uuid:78ea76bb-b195-4a62-8fb6-fa5510cd0928
name:Santa-2014.jpeg
bucket:divvito-documents-dev
Content-Disposition:inline; filename=Santa-2014.jpeg
size:2001403
type:image/jpeg
qquuid:78ea76bb-b195-4a62-8fb6-fa5510cd0928
Also to be checked that in the _formatSize method, the size in bytes is being devided by 1000 (1e3), but I guess it should actually be divided by 1024.
1000 is correct, 1024 is not
@rnicholus : If it's in bytes, for me, 1000 would be incorrect. If you convert from bytes to kb's you divide by 1024 and then to mb by 1024 again.
Well, there is no measurement for “kb” or “mb”. If you’re speaking of kB or MB, then powers of ten (SI) is correct. But if you instead want KiB or MiB, then you should use powers of 2. Fine Uploader has been following the SI method for a very long time, and that will not change.
ok. Thanks for the info @rnicholus