javascript - Storing base64 strings to GridFS(mongoDB file storage) -


i'm trying paste image clipboard <img> tag. source of image prnt scrn command , not file. clipboard image in base64 format. base64 string can inserted src attribute of <img> tag(once ctrl-v pressed) using javascript display purposes. accomplishable using plugin.

so <img> tag this:

<img id="screen_image" src="data:image/png;base64,ivborw0kggoaaaansuheugaabvyaaamacai......(long string here)" 

although, persist entire string mongodb collection , retrieve displaying image, ultimate goal persist image gridfs. there way if interpret base64 file , persist gridfs?

i hope i've made clear. comments welcome.

update: want maintain common collection store images or file matter(i'm using gridfs persist file attachments not want create new collection store clipboard images). have tried decoding string using window.atob() don't know how persisted gridfs

i'm using mongo senior project right , storing child (client local non profit world vision) pictures gridfs i've moved storing them in actual child doc in base64. of images around 3mb , base64 converts out 4-5mb. if can store them base64 makes simpler schema, think.

i know said wanted use gridfs, go route if have files on 16mb. hope obvious reasons it's simpler store them strings in docs.


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -