deepai-js-client icon indicating copy to clipboard operation
deepai-js-client copied to clipboard

How to save as file instead of just displaying image?

Open jamieduk opened this issue 3 years ago • 2 comments

How to save as file instead of just displaying image?

it works in div id but now i also wish to store the rendered file from the remote api to a local file for example username/output.jpg how can I do this?

i think maybe making the call an object then i can save object but dont know how to do that, or maybe with canvas again dont know how to put your render to a canvas and save, can you help with this?this is basic simple stuff I expected it to have already!!!

jamieduk avatar Aug 01 '21 19:08 jamieduk

How do I save an image from an api response async and deepai

Im using deep AI API to make an image a cartoon

await deepai.renderResultIntoElement(result, document.getElementById('RES')); })();

is the code, how can I save that file as well as it be displayed in a RES div? it renderes but cant work out how to automatically store the file (that comes back from api) I need the file to be dynamically named along php for example $username/output.jpg

so php tags need to be used no ' only " . Any ideas?

jamieduk avatar Aug 01 '21 19:08 jamieduk

@jamieduk you can add the "download" attribute in a link button.

zippytyro avatar Jun 24 '22 12:06 zippytyro