title: Display image created using GD library in different PHP file
body: <p>I have index.php where I ask user to select two images to combine.. The selection is done using check boxes.
  User then clicks on the button on which I pass the selected image paths to MergeImages.php , the merge image.php combines the two icons with some other processing and create one image, which I need to display on the index.php just below the list of images.</p>
  
  <p>Here is my code for that
  Index.php</p>
  
  <pre><code>var Images;
  Images = listOfImages.join("|");
  $.ajax({
  url: 'MergeImages.php',
  type: 'POST',
  data: {listOfImages : Images},
  success: function(data) {
   alert("success");
   $("#output_image").attr("src","MergeImages.php" );
   },
   error: function(jqXHR, textStatus, errorThrown) {
   console.log(textStatus, errorThrown);
   }
   });
   }
  </code></pre>
  
  <p>MergeImages.php</p>
  
  <pre><code>imagecopy($dest, $src, 0,0,0,0,$swidth,$sheight); 
  
  header('Content-Type: image/png');
  imagepng($dest);
  </code></pre>
  
  <p>The image is not displayed, what could be the problem?</p>