Get iOS image, resize file and display within hype object


#1

Trying to add a button to a hype scene that when pressed allows the user to select an image. If using a mobile device it would give the option of camera or photo library.

<input type="file" accept="image/*" />

The code above seems to work to get the file access and on a mobile device allows for camera or photo library options.

Not sure how to capture that file with a triggered javascript event to manipulate the file size to say 1MB or less and then display it on the same hype scene within an object.style.backgroundImage.

I have found a way to pick an image on a browser and display the object but it does not seem to work on mobile device, nor do I know how to attempt the resize of the image down to 1MB or less.

Any help would be great! Thanks


(Mark Hunte) #2

I would have a look through the threads talk about using Canvas

Maybe canvase and image.

https://forums.tumult.com/search?q=canvas%20image

and

google search for javascript canvas image manipulation