<?php
// array for JSON response

  $response= array();

    if (isset($_POST['DisplayImage']) && isset($_POST['ImageName']) && isset($_POST['ImagePath'])){

      $DisplayImage = $_POST['DisplayImage'];
	  $Name = $_POST['ImageName'];
	   $folder = $_POST['ImagePath'];

     
      $path = $folder;
      // $path = 'https://api.easysoftapp.com/PhpApi1/ClientImages/17.png';
      if (!file_exists($path)) {
            mkdir($path, 0777, true);
      }
      
      $decodedImage = base64_decode($DisplayImage);
      $return = file_put_contents($path."/".$Name, $decodedImage);

      // success
      $response["success"] = 1;
      $response["message"] = $return;
      // echoing JSON response
      echo json_encode($response);
    }else{
		// success
      $response["success"] = 0;
      $response["message"] = "IMAGE NOT SEND";
      // echoing JSON response
      echo json_encode($response);
	}
?>
