Link to home
Start Free TrialLog in
Avatar of tr5
tr5

asked on

How to convert gif to jpg

Hi

I upload gifs which I want to convert and save as jpgs. I do this:

...
$image = @imagecreatefromgif($filename);
if($image)
{
  $image_p = imagecreatetruecolor($new_width, $new_height);
  imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
  imagejpeg($image_p, $filename_tn, 100); // 100% quality
}

Will that do the job, or is something else needed?

Thanks
tr5
ASKER CERTIFIED SOLUTION
Avatar of Raynard7
Raynard7

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tr5
tr5

ASKER

How would I do that?
well - you have $image

= imagecreatefromgif($filename)

you should just be able to point it to the uploaded file

= imagecreatefromgif($_FILE['uploadedFileName']);

and the rest of the script would remain the same
Avatar of tr5

ASKER

ok. Thanks.