Posts

Showing posts from October, 2017

image upload using jquery ajax when form submit php

   <td><button type="button" class="send_notification" onclick="sendNotification(<?php echo $row['patient_id']; ?>)">SEND</button></td>  function sendNotification(patient_id) {   $('#modal-content').on('shown.bs.modal', function () {         $("#message").focus();     });        $('#modal-content').modal({         show: true     });          $('.notification_submit').click(function(event){          event.preventDefault();           var message= $('#message').val();                       var file_data = $("#file").prop("files")[0];   // Getting the properties of file from file field     var f...

image upload with multiple fields using jquery ajax in php mysql

  <input id="avatar" type="file" name="avatar" /> <button id="upload" value="Upload" />    $(document).on("click", "#upload", function() { var file_data = $("#avatar").prop("files")[0]; // Getting the properties of file from file field var form_data = new FormData(); // Creating object of FormData class form_data.append("file", file_data) // Appending parameter named file with properties of file_field to form_data form_data.append("user_id", 123) // Adding extra parameters to form_data $.ajax({ url: "/upload_avatar", dataType: 'script', cache: false, contentType: false, processData: false, data: form_data, // Setting the data...

dynamic create multiple ckeditor onclick event using jquery

<!DOCTYPE html> <html> <head> <title>New Ckeditor Instance Dynamically</title> <script type="text/javascript" src="ckeditor_3.5/ckeditor/ckeditor.js"></script> <script type="text/javascript" src="scripts/jquery-1.4.4.js"></script> <script type="text/javascript" src="ckeditor_3.5/ckeditor/adapters/jquery.js"></script> <script type="text/javascript"> $(document).ready(function() { $('.jquery_ckeditor').ckeditor(); }); </script> <script> function newCkeditor(){ $('<div><textarea><\/textarea><\/div>') .appendTo('#body').find('textarea').ckeditor(); } function clicked(){ for ( instance in CKEDITOR.instances ){ alert("ckeditor values : " + CKEDITOR.instances[instance].getData()); } } </script> </head> <body...

remove black background when resize image in php

 /* image resize in php when form submit */ if(isset($_POST['submit'])) {   function resize($width, $height){     include('conn.php');     $root=$_POST['root'];    $category=$_POST['category'];    $sub_category=$_POST['sub-category'];   $product_name=$_POST['product_title'];     $product_specification=mysqli_real_escape_string($con,$_POST['product_description']);     list($w, $h) = getimagesize($_FILES['image']['tmp_name']);   $ratio = max($width/$w, $height/$h);   $h = ceil($height / $ratio);   $x = ($w - $width / $ratio) / 2;   $w = ceil($width / $ratio);   $path= '../product_images/'.$width.'x'.$height.'_'.$_FILES['image']['name'];     $product_title= $_POST['product_title'];   $product_description= $_POST['product_description'];    $actual_link = "http://$_SERVER[HTTP_HOST]$_SERVER[REQUEST_URI]";  $actual_link = dirname($actual_link);   $full_...