Connecting Tech Pros Worldwide Help | Site Map

HOW TO: convert a gif to a jpg in php?

gsb
Guest
 
Posts: n/a
#1: Jul 17 '05
I have only used the GD lib a little.
Is there a way to convert a file from a .gif to a .jpeg file?

Thanks,

gsb


Filth
Guest
 
Posts: n/a
#2: Jul 17 '05

re: HOW TO: convert a gif to a jpg in php?


> I have only used the GD lib a little.[color=blue]
> Is there a way to convert a file from a .gif to a .jpeg file?[/color]

According to a book I have GD does not support Gif file formats anymore

but the following might help you depending on the version of GD you have

http://uk2.php.net/manual/en/functio...atefromgif.php



Daniel Tryba
Guest
 
Posts: n/a
#3: Jul 17 '05

re: HOW TO: convert a gif to a jpg in php?


gsb <gsb@qwest.net> wrote:[color=blue]
> I have only used the GD lib a little.
> Is there a way to convert a file from a .gif to a .jpeg file?[/color]

Use http://us3.php.net/manual/en/function.imagejpeg.php with
http://us3.php.net/manual/en/functio...atefromgif.php as the
source.

--

Daniel Tryba

Filth
Guest
 
Posts: n/a
#4: Jul 17 '05

re: HOW TO: convert a gif to a jpg in php?


> > I have only used the GD lib a little.[color=blue][color=green]
> > Is there a way to convert a file from a .gif to a .jpeg file?[/color]
>
> Use http://us3.php.net/manual/en/function.imagejpeg.php with
> http://us3.php.net/manual/en/functio...atefromgif.php as the
> source.[/color]

might not work because of the following

Note: Since all GIF support was removed from the GD library in version 1.6,
this function is not available if you are using that version of the GD
library.


Andy Hassall
Guest
 
Posts: n/a
#5: Jul 17 '05

re: HOW TO: convert a gif to a jpg in php?


On Thu, 6 May 2004 20:49:14 +0100, "Filth" <p.macdonald@blueyonder.co.uk>
wrote:
[color=blue][color=green][color=darkred]
>> > I have only used the GD lib a little.
>> > Is there a way to convert a file from a .gif to a .jpeg file?[/color]
>>
>> Use http://us3.php.net/manual/en/function.imagejpeg.php with
>> http://us3.php.net/manual/en/functio...atefromgif.php as the
>> source.[/color]
>
>might not work because of the following
>
>Note: Since all GIF support was removed from the GD library in version 1.6,
>this function is not available if you are using that version of the GD
>library.[/color]

True, but the version of GD bundled with PHP (equivalent to nearly the latest
2.0 series of GD plus some extra patches) has had read-only GIF support
restored a few versions ago - imagecreatefromgif works, but imagegif won't.

--
Andy Hassall <andy@andyh.co.uk> / Space: disk usage analysis tool
http://www.andyh.co.uk / http://www.andyhsoftware.co.uk/space
Phil Powell
Guest
 
Posts: n/a
#6: Jul 17 '05

re: HOW TO: convert a gif to a jpg in php?


What would you then recommend as an alternative to imagegif() since
it's READ-ONLY (verifying with PHP 4.3.2 and imagetypes() verifies its
existence but apparently cannot be used)?

Thanx
Phil

Andy Hassall <andy@andyh.co.uk> wrote in message news:<0p6l909ujs8bdqjtu4r9j6asn8tjqel3rv@4ax.com>. ..[color=blue]
> On Thu, 6 May 2004 20:49:14 +0100, "Filth" <p.macdonald@blueyonder.co.uk>
> wrote:
>[color=green][color=darkred]
> >> > I have only used the GD lib a little.
> >> > Is there a way to convert a file from a .gif to a .jpeg file?
> >>
> >> Use http://us3.php.net/manual/en/function.imagejpeg.php with
> >> http://us3.php.net/manual/en/functio...atefromgif.php as the
> >> source.[/color]
> >
> >might not work because of the following
> >
> >Note: Since all GIF support was removed from the GD library in version 1.6,
> >this function is not available if you are using that version of the GD
> >library.[/color]
>
> True, but the version of GD bundled with PHP (equivalent to nearly the latest
> 2.0 series of GD plus some extra patches) has had read-only GIF support
> restored a few versions ago - imagecreatefromgif works, but imagegif won't.[/color]
Leslie
Guest
 
Posts: n/a
#7: Jul 17 '05

re: HOW TO: convert a gif to a jpg in php?



"Phil Powell" <soazine@erols.com> wrote in message
news:1cdca2a7.0405100537.58937026@posting.google.c om...[color=blue]
> What would you then recommend as an alternative to imagegif() since
> it's READ-ONLY (verifying with PHP 4.3.2 and imagetypes() verifies its
> existence but apparently cannot be used)?
>
> Thanx
> Phil[/color]

imagepng()


Phil Powell
Guest
 
Posts: n/a
#8: Jul 17 '05

re: HOW TO: convert a gif to a jpg in php?


"Leslie" <lesliethoare@hotmail.com> wrote in message news:<2ga4fcFf6ngU1@uni-berlin.de>...[color=blue]
> "Phil Powell" <soazine@erols.com> wrote in message
> news:1cdca2a7.0405100537.58937026@posting.google.c om...[color=green]
> > What would you then recommend as an alternative to imagegif() since
> > it's READ-ONLY (verifying with PHP 4.3.2 and imagetypes() verifies its
> > existence but apparently cannot be used)?
> >
> > Thanx
> > Phil[/color]
>
> imagepng()[/color]

That doesn't work on GIF images, only on PNG. I would have to convert
them from GIF to PNG.

Phil
Leslie
Guest
 
Posts: n/a
#9: Jul 17 '05

re: HOW TO: convert a gif to a jpg in php?


> > imagepng()[color=blue]
>
> That doesn't work on GIF images, only on PNG. I would have to convert
> them from GIF to PNG.
>
> Phil[/color]

Why would you? You could use the imagecreatefromgif() function to read any
current gif images you may have, and use imagepng() to write your output as
png. Or is there some reason for you to need the output files to be gif? If
so, you're out of luck as far as GD is concerned.

-Leslie


Phil Powell
Guest
 
Posts: n/a
#10: Jul 17 '05

re: HOW TO: convert a gif to a jpg in php?


Which is why I have to convert from GIF to PNG. They want them to be
viewable as actual resized images which can only be done if they are
not GIF images. Using gif2png works though nicely!

Phil

"Leslie" <lesliethoare@hotmail.com> wrote in message news:<2gebc1F1tesnU1@uni-berlin.de>...[color=blue][color=green][color=darkred]
> > > imagepng()[/color]
> >
> > That doesn't work on GIF images, only on PNG. I would have to convert
> > them from GIF to PNG.
> >
> > Phil[/color]
>
> Why would you? You could use the imagecreatefromgif() function to read any
> current gif images you may have, and use imagepng() to write your output as
> png. Or is there some reason for you to need the output files to be gif? If
> so, you're out of luck as far as GD is concerned.
>
> -Leslie[/color]
Closed Thread