How to Save Signature as an Image

I understand that we can’t easily write signature data to local devices. I disagree but understand.

But in the Signature capture example, it saves the signature as a string data. Then it says you use AJAX to send it to the server.

That is fine but what is the php code to accept that data and save it on the server as an image (preferrably .bmp)?

I can’t find anything on that side. So I can capture the signature, I can send it but have no clue how to save it.



You can’t write data into file systems using the browser for some very good security reasons. Imagine if any web page could write files onto your computer or device.

To upload images, they need to be converted to Base64. This results in a normal text string which is easy to move around the net.

You’re asking a PHP question: How do I convert a Base64 string to an image file?

I’m no PHP expert, but this article looks like a good place to start.

Thanks. The stuff I’m working on is fine if someone writes files because Unix does not treat data files like code the way some apps do.

But, as I said, I understand the reasoning. I was just disappointed that ther was not an end to end sample for some of this stuff like signature capture.

But that article seemed like a good point to help me figure it out.