samedi 2 décembre 2017

How can i save image captured image from webcam with form data in laravel

Hi Everyone I have a simple form and i want to save form data after capture image using ajax but i have no idea how can i upload image in upload folder and save image path in database table pls help me thanks.

Form enter image description here

Capture Image JS

<script type="text/javascript" src=""></script>
$(function(){
$( '#example' ).photobooth().on( "image", function( event, dataUrl ){
    $( "#gallery" ).show().html( '<img id="imgdata" src="' + dataUrl + '" >');
});

/**
* Tab boxes
*/
$( '.tab_container' ).each(function( i, elem ){
    $( elem ).find( ".tabs li" ).click(function(){
        $( elem ).find( ".tabs li.selected" ).removeClass( "selected" );
        $( this ).addClass( "selected" );
        $( elem ).find( ".tab_content" ).hide();
        $( elem ).find( ".tab_content." + $(this).attr( "calls" ) ).show();
    });
});

/**
* Link highlighting
*/
$( "a" ).click(function(){
    $( "#nav a.selected" ).removeClass( "selected" );
    $( "#nav a[href=" + $(this).attr( "href" ) + "]" ).addClass( "selected" );
});
});

Ajax call JS

$(".loader").show();
        $.post("",
        {
            company_id : $('#company_id').val(),
            visitor_id : $('#visitor_id').val(),
            mobile : $('#mobile').val(),
            name : $('#name').val(),
            contact_person : $('#contact_person').val(),
            purpose : $('#purpose').val(),
            company : $('#company').val(),
            img :  dataURL
        },
        function(data){
            $("#response").html(data);
            $(".loader").removeAttr("disabled");
            $(".loader").fadeOut(1000);
        });

HTML

                        <div class="col-md-8">
                        <div id="example" style="width: 320px; height: 240px;"></div>
                        <div id="gallery" style="width: 320px; height: 240px;">

                        </div>
                    </div>



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire