title: create download link for php created image
body: <p>I am working on a little resize and download image kind of php script wherein the events must happen in the following fashion :</p>
  
  <ol>
  <li><p>A visitor uploads an image file.</p></li>
  <li><p>The image is resized by the script.</p></li>
  <li><p>A download link to the resized image appears in the front-end.</p></li>
  </ol>
  
  <p>My resizing code is ready and working but I need help with the third part, that is how do I offer a download link to the recently created image. Here is a gist of how the resized image is created i the php script.</p>
  
  <pre><code>&lt;?php  
         //normal validation stuff happens here
         //resizing stuff happens here
  
      //here is last part of the code that creates the resized image
  
      $filename = uniqid();
      $file = 'uploads/'.$filename.'.jpeg';   
      imagejpeg($new, $file, 80); 
      imagedestroy($new);
  </code></pre>
  
  <p>This <strong>download link must prompt as a download box</strong> instead of opening a new tab. <code>Headers</code> is what I know is needed in case we need to offer a download link. But this is useless to me unless I understand a right approach to this. Also please understand that my situation may be a little different as this is not a download link for a static-resource. Here the images to be downloaded are created dynamically at every request, everytime.</p>
  
  <p>While I am struggling on my own a solution, will be great otherwise please provide me a road-map of what steps should be taken or what are functions that I will need to get this done. Thanks in advance. </p>