Impact

This forum is read only and just serves as an archive. If you have any questions, please post them on github.com/phoboslab/impact

1 decade ago by henonchesser

Is it possible to load images to temporary storage or allow Impact to get images from local storage?

In this instance I want to develop a playground for our artist that will allow her to upload files or select sprite sheets to be seen immediately without her needing to know code or having to have the source game on her machine.

1 decade ago by lTyl

You can't store an image 'as-is' into localStorage, but you can change an image into a dataURL and save it that way:
savedImg = canvas.toDataURL(imageType, imageQuality);
localStorage.setItem("Key", savedImg);

imageType is assumed to be 'image/png', image quality, if provided, is only used if you are using 'image/jpeg' or 'image/webp' and has the range 0.0 - 1.0. More: https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement#Methods
Page 1 of 1
« first « previous next › last »