Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

imagegif() function 1

Status
Not open for further replies.

cLFlaVA

Programmer
Jun 14, 2004
6,450
US
hi all.

i'm creating a thumbnail creator, and i have two seperate sections of the code - one for jpegs and one for gifs.

after using imagecopyresampled, my last step is using imageJPEG and imageGIF depending on the image type.

as you know i'm about to say, this works fine with jpegs but i get the following error when I try to create the gif:

the image "..." cannot be displayed because it contains errors.

i then do a view source and i see this:

[tt]<br />
<b>Fatal error</b>: Call to undefined function: imagegif() in <b>/home/httpd/vhosts/.../httpdocs/item.php</b> on line <b>135</b><br />[/tt]

so, what does this mean? i'm confused as to why imageJPEG would be defined but imageGIF would not be...

thanks for your insight!



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
That would be because GIF is a proprietary image format owned by the CompuServe corportation, so the GD library has not supported the manipulation of GIFs.

What version of GD are you using? GIF manipulation was reenabled in GD version 2.0.28





Want the best answers? Ask the best questions! TANSTAAFL!
 
nah, unfortunately it's for a guy i'm working with that's running his own server - with php 4 something.

i've been researching this for a while - i managed to work around this using the following:

Code:
if ( $strFileType == "image/gif" ) == "gif" ) {
    exec(EscapeShellCmd("convert -geometry 125x125 -quality 75 " . $strFullFilePath . " " . $strFullFilePath ));
} else {
    exec(EscapeShellCmd("convert -geometry 125x125 -quality 75 jpg:" . $strFullFilePath . " jpg:" . $strFullFilePath ));
}

luckily i was able to utilize shell commands. is this an acceptable method? are there any issues with this you know of?


thanks sleip.



*cLFlaVA
----------------------------
[tt]"quote goes here"[/tt]
[URL unfurl="true"]http://www.coryarthus.com/[/url]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top