You are viewing limited content. For full access, please sign in.

Question

Question

save images to database

asked on April 30, 2019

I use file  upload in Laserfiche form to capture photo using mobile camera then I custom Javascript code to convert this photo to base64 to save it in database. the problem that base64 characters length is more than 30,000 character and it not accepted in workflow and it make database size big. are there any idea to reduce base 64 characters or to store image to sql database from laserfiche forms.

here my code to convert image to base64

$(document).ready(function(){    
  ( function ( $ ) {
      $('#q2 input').on('change', function () {
      if ( ! window.FileReader ) {
        return alert( 'FileReader API is not supported by your browser.' );
      }
      var $i = $( '#q2 input' ), 
          input = $i[0];
      if ( input.files && input.files[0] ) {
        file = input.files[0]; 
        fr = new FileReader(); 
        fr.onload = function () {
          $( '#q4 textarea' ).html( fr.result ) 
        };
        fr.readAsDataURL( file );
      } else {
        alert( "File not selected or browser incompatible." )
      }
    } );
  } )( jQuery );

 

0 0

Replies

replied on April 30, 2019

If you really want to store the images in a database, they will have to be in a blob column as a binary array.  There's no way to get around the effect of storing that much data in database, it's going to be big.  That's one of the reasons that Laserfiche stores image data on disk instead of in the database.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.