I want to convert an image file do another format (jpeg, bmp, png or gif) chosen from a drop-down list.
$ext is the extension of the original uploaded file
My code shows the case that I upload a jpeg and want to convert it to png (so I choose png from the dropdown list). How should I change the following code? I want to move the new file to uploads/ directory
[php]
if ($ext=‘jpg’ or $ext=‘jpeg’)
{
switch ($target)
{
case “PNG”;
$image = imagecreatefromjpeg($path);
imagepng($image, $file . ‘png’, 100);
move_uploaded_file($image,$target_path);
break;
}
}
[/php]