Back

[SOLVED] problems with storage file

  • 0
  • Web
  • Storage
fafa
23 Nov, 2023, 18:30

So do you want to save storage space, or just resize images?

TL;DR
User was experiencing problems with a storage file. They were able to solve the issue by pushing the result blob into an array and then pushing the image to Appwrite with the fileObj variable. They used a vanilla JS tool to turn the information into a file. The user suggests using a converter or compressing the image beforehand to avoid having to programmatically transform it later. Another user mentions using image transformations from Appwrite's documentation. They discuss the difference between using a preview or resizing the image before storage.
bonndubz
23 Nov, 2023, 18:30

it would be both

fafa
23 Nov, 2023, 18:31

Because if resizing, I guess you could use: https://appwrite.io/docs/products/storage/images

bonndubz
23 Nov, 2023, 18:31

oh well lets see

bonndubz
23 Nov, 2023, 18:32

oh but that just shows a preview of the file

bonndubz
23 Nov, 2023, 18:32

like it doesnt actually gets resized before getting into the storage

fafa
23 Nov, 2023, 18:32

It does not, but does it matter what the exact size is?

fafa
23 Nov, 2023, 18:33

I'm generally curious 😄

bonndubz
23 Nov, 2023, 18:33

well tbh yeah i dont want users to load 1k px images on each user's profile photo

fafa
23 Nov, 2023, 18:34

I think that's where image transformations comes in

fafa
23 Nov, 2023, 18:34

It's called "preview", but it's actually the full image, just with different options

fafa
23 Nov, 2023, 18:35

AFAIK

bonndubz
23 Nov, 2023, 18:35

yeah that could be good but wouldnt it actually be better to just compress the image beforehand so then i dont have to programatically do a transform later?

fafa
23 Nov, 2023, 18:35

Sure. But as Steven said, I don't think that's supported. Otherwise you'd need a service in between that would do this for you

fafa
23 Nov, 2023, 18:36

What you basically need in the end, is the actual file, not just a blob

bonndubz
23 Nov, 2023, 18:36

could maybe use a conversor

bonndubz
23 Nov, 2023, 18:36

imma see if i can do anything about it

fafa
23 Nov, 2023, 18:36

Sure, good luck!

bonndubz
23 Nov, 2023, 18:37

tytyty

bonndubz
23 Nov, 2023, 18:41

ok simple fix

bonndubz
23 Nov, 2023, 18:42

just had to use vanilla JS tool to turn information into a file

TypeScript
let fileObj = new File([result], file.name, { type: 'image/png' });
bonndubz
23 Nov, 2023, 18:43

pushed the result blob into it as an array then just pushed the image to appwrite with the fileObj var

bonndubz
23 Nov, 2023, 18:43

ill mark this as fixed now

bonndubz
23 Nov, 2023, 18:43

[SOLVED] problems with storage file

bonndubz
23 Nov, 2023, 18:47

i would like the link to be simpler tho tbh but its all good

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more