title: dataurl to image for download in php
body: <p>I'm creating image using <strong>canvas</strong> and using following script,</p>
  
  <pre><code>function getImage() {
      var canvas1 = document.getElementById("images");
  
      if (canvas1.getContext) {
          var ctx = canvas1.getContext("2d");
          var myImage = canvas1.toDataURL("image/jpg");
      }
      $('&lt;form action="download.php" method="POST"&gt;' + 
      '&lt;input type="hidden" name="aid" value="' + myImage + '"&gt;' +
      '&lt;/form&gt;').submit();
  
  }
  </code></pre>
  
  <p>And in my Download.php file is,</p>
  
  <pre><code>&lt;?php $img = $_POST['aid']; 
      echo "&lt;img src=".$img."&gt;";
  ?&gt;
  </code></pre>
  
  <p>it showing image correctly. But i wanna give download button with jpg format or pdf format.</p>
  
  <p>How i can use? </p>
  
  <p>I used <strong>base64_decode();</strong> method. But i cant solve.</p>
  
  <p>Help me...</p>