convert image to jpg and transparency
<p>I have script:</p>

<pre><code>$path = "uploads/";

$img = $_FILES['photoimg']['tmp_name'];
$dst = $path . $_FILES['photoimg']['name'];

if (($img_info = getimagesize($img)) === FALSE)
  die("Image not found or not an image");

$width = $img_info[0];
$height = $img_info[1];

switch ($img_info[2]) {
  case IMAGETYPE_GIF  : $src = imagecreatefromgif($img);  break;
  case IMAGETYPE_JPEG : $src = imagecreatefromjpeg($img); break;
  case IMAGETYPE_PNG  : $src = imagecreatefrompng($img);  break;
  default : die("Unknown filetype");
}

$tmp = imagecreatetruecolor($width, $height);
imagecopyresampled($tmp, $src, 0, 0, 0, 0, $width, $height, $width, $height);
imagejpeg($tmp, $dst.".jpg");
</code></pre>

<p><a href="http://stackoverflow.com/questions/14550299/how-to-connect-move-uploaded-file-and-imagejpeg">How to connect move_uploaded_file and imagejpeg?</a></p>

<p>This working perfect, but if file is png and have transparency then my new image have black background. Can i change this color? I would like have white background.</p>
