What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    How to save signature in Mysql

    Asked by johnwheeler on November 05, 2013 at 07:00 PM

    Hi,

    I am following the guide on saving my form to Mysql but am unsure as to how to save the signature which shows as

    data:image/png;base64 , is this just a blob, as it does not appear to save.

    I googled and established it as a method for being read by html.

     

    png
  • Profile Image
    JotForm Support

    Answered by EltonCris on November 05, 2013 at 11:57 PM

    Hi there,

    You can use the following code to convert the base64 image string into an image file.

    http://stackoverflow.com/questions/15153776/convert-base64-string-to-an-image-file

    Example:

    function base64_to_jpeg( $base64_string, $output_file ) {

        $ifp = fopen( $output_file, "wb" ); 

        fwrite( $ifp, base64_decode( $base64_string) ); 

        fclose( $ifp ); 

        return( $output_file ); 

    }

    //assign variable for your esignature post data, .e.g

    $my_base64_string = $_POST['signature4'];

    //call

    $esignature = base64_to_jpeg($my_base64_string, 'tmp.jpg' );

    There are few more scripts you can find at Google. If you require further assistance, do let us know here. Regards!

  • Profile Image
    JotForm Support

    Answered by EltonCris on November 06, 2013 at 12:01 AM

    Here is also a good one: http://stackoverflow.com/questions/4110907/how-to-decode-a-base64-string-gif-into-image-in-php-html

    Just let us know if you help with this. Thanks!