Search code examples
javascriptphpsqloracle-databasebase64

insert Signature-Pad in Oracle database


I've got a problem with signature-pad: GitHub signature-pad

When my signature is too fat I can't save it in my database.

My field is in BLOB type. I store the signature in base64.

I insert the base64 signature like this:

INSERT INTO MY_TABLE(ID, SIGNATURE) values (1, utl_encode.base64_decode(utl_raw.cast_to_raw('iVBORw0KGgoAAAANSUhEUgAAAZAAAADICAYAAADGFbfiAAAcaklEQVR4nO3dzYrdyB[...]AASUVORK5CYII=')));

This is an Oracle 11G database.

Do you have any solve or do you know how to reduce the picture quality or anything else which can reduce file size.


Solution

  • I just found !

    $sql = "INSERT INTO MY_TABLE(id, signature)
            VALUES (1, EMPTY_CLOB())
            RETURNING signature INTO :signature";
    
    $stid = oci_parse($conn, $sql);
    $clob = oci_new_descriptor($conn, OCI_D_LOB);
    oci_bind_by_name($stid, ":signature", $clob, -1, OCI_B_BLOB);
    oci_execute($stid, OCI_NO_AUTO_COMMIT);
    $clob->save(base64_decode($mySignatyure);
    
    oci_commit($conn);
    

    And it's work.

    One day of research just for that..