Page 1 of 1
gif 2 jpg conversion
Posted: Mon Aug 25, 2003 5:57 am
by moeed
Is it possible to convert gif image in to jpg image on the fly using GD library
Moeed
Yes! This is easy!
Posted: Mon Aug 25, 2003 6:18 am
by Orkan
Here is a code for doing this:
Code: Select all
<?php
$imgfile="asc.gif";
$image=imageCreateFromGIF($imgfile);
imageJpeg($image, "asc.jpg");
@imagedestroy($image);
?>
converts asc.gif in asc.jpg
Posted: Tue Aug 26, 2003 1:05 am
by moeed
Thanx for the reply. I have used the code supplied by u but it produces an error whih is given below. Can u please figure out problem.
Code: Select all
Warning: ImageCreateFromGif: No GIF read support in this PHP build in c:\apache\htdocs\convert.php on line 3
Warning: Supplied argument is not a valid Image resource in c:\apache\htdocs\convert.php on line 4
Thank You
Moeed
:(
Posted: Tue Aug 26, 2003 1:32 am
by Orkan
What can I say... try installing new PHP version or GD library...
Posted: Tue Aug 26, 2003 1:39 am
by gite_ashish
From PHP Manual -
"Versions of GD older than gd-1.6 support GIF format images, and do not support PNG, where versions greater than gd-1.6 support PNG, not GIF."
"GIF - Only supported in GD versions older than gd-1.6. Read-only GIF support is available with PHP 4.3.0 and the bundled GD-library."
You can check your PHP install details using:
<?php
phpinfo();
?>
and look for word/section - gd
Funny...
Posted: Tue Aug 26, 2003 1:46 am
by Orkan
Funny thing...
I have PHP v. 4.1.2. and GD2 and can read GIF, read&create PNG...
:\
Posted: Tue Aug 26, 2003 1:52 am
by gite_ashish
Orkan: do you have both support - read & create - GIF with PHPv4.1.2/GD2.
Posted: Tue Aug 26, 2003 1:57 am
by Orkan
Only read GIF
But read and create PNG...
Posted: Tue Aug 26, 2003 11:26 am
by m3rajk
due to compuserve's new owners getting picky and wanting royalties youhave to get a third party add in to do more than read. read is still open to everyone. anything more and you now have to pay royalties.
therefore it was dropped in versions newer than 1.6
many hosts will get third party add ins so you can still do stuff though, so check with your host.