Skip to content
Advertisement

Convert base64 string to image

I am trying to crop/resize user profile image using jquery plugin namely crop.js which sends user image as base64 via ajax to my controller as

JavaScript

but I unable to decode this base64

JavaScript

string as Image,Can you guys guide me how can I save my base64 string as image on my server?.

Advertisement

Answer

This assumes a few things, that you know what the output file name will be and that your data comes as a string. I’m sure you can modify the following to meet your needs:

JavaScript

Please note, this is just an example of what parts are involved. I haven’t optimized this code at all and it’s written off the top of my head.

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement