title: Uploaded ZIP archive. Convert only PNG to JPEG in PHP
body: <p>For the life of me, I cant figure out how to code part of this process:</p>
  
  <p><strong>Ive Already Completed These Steps:</strong><br/>
   1. Upload ZIP archive (containing only photos in gif, png, and jpg)<br/>
   2. Unpack to folder<br/>
   3. Scan folder for filenames + file extentions</p>
  
  <p><strong>I Need Help With:</strong><br/>
   4. Convert only PNG to JPG</p>
  
  <p>Any help would be appreciated!</p>
  
  <h2>Brandon</h2>
  
  <p>EDIT:<br>
  Does this make sense?</p>
  
  <pre><code>$directory = "../images/ilike/goldfish/";
  $images = glob($directory . "*.jpg");
  
  foreach($images as $image)  
  {  
  $pic = imagecreatefrompng($directory);  
  $bg = imagecreatetruecolor(imagesx($image), imagesy($image));  
  imagefill($bg, 0, 0, imagecolorallocate($bg, 255, 255, 255));  
  imagealphablending($bg, TRUE); 
  imagecopy($bg, $pic, 0, 0, 0, 0, imagesx($image), imagesy($image))  
  imagedestroy($image);  
  imagejpeg($bg, $image . ".jpg", 100);  
  ImageDestroy($bg);  
  }
  </code></pre>