Thumbails and image file size

Started by camel1cz0 replies489 views
camel1czOriginal post
#1

I’m using Uppy 1.20.0 with great results, thank you!

One thing what bothers me is the file size shown in image preview.

In short, is there a way to specify the file size of the image displayed in the dashboard?

Full version: When I prefill Uppy with existing images, I want to download only thumbnails from the server. So I call addFile setting my own thumbnails as the displayed image like this:

fetch('/dsn/image/id/xxx.jpg/?size=1')
  .then((response) => response.blob()) // returns a Blob
  .then((blob) => {
    uppy.addFile({
      name: '<?= $fileName; ?>', // image name
      source: 'mysouce',
      type: blob.type,
      data: blob,
      remote: true,
      meta: {
        caption: '<?= $caption; ?>',
        fileid: '<?= $id(); ?>',
        origcaption: '<?= $description; ?>',
        origname: '<?= $orig_name; ?>',
        fileEditable: true,
      },
    });
});

Everything is fine but instead of the file size I want to see, there is shown filesize of the thumbnail - most likely from the size of the blob downloaded.

I would like to show custom size (original or other variant) of the image. Is this possible?