fine-uploader icon indicating copy to clipboard operation
fine-uploader copied to clipboard

Upload success size parameter not correct for scaled images

Open ghost opened this issue 8 years ago • 5 comments

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:

  1. Select 3 files
  2. Pause the 2nd file before it completes, but after it has started.
  3. 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

ghost avatar Sep 06 '17 11:09 ghost

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.

frandevel avatar Nov 22 '17 11:11 frandevel

1000 is correct, 1024 is not

rnicholus avatar Nov 22 '17 14:11 rnicholus

@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.

frandevel avatar Nov 22 '17 14:11 frandevel

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.

rnicholus avatar Nov 22 '17 14:11 rnicholus

ok. Thanks for the info @rnicholus

frandevel avatar Nov 22 '17 14:11 frandevel