Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hello,
I'm building a picture gallery and I'm using the imagecreatefromgif function to create thumbnails. It works perfectly but if you try to run the function again on the gif that was created by the first imagecreatefromgif() call you then get a warning message that the .gif file is not a valid GIF file.
It's strange that the function will create a perfectly sized gif the first time and then when you try to run that gif that it just created through the function again it gives you an error message.
Here's my code:Code: Select all
if( strpos(strtolower($source_file),".gif") )
{
$img_source = imagecreatefromgif($source_file); /* Attempt to open */
if(!$img_source)
{ /* See if it failed */
$img_source = imagecreatetruecolor (150, 30); /* Create a blank image */
$bgc = imagecolorallocate ($img_source, 255, 255, 255);
$tc = imagecolorallocate ($img_source, 0, 0, 0);
imagefilledrectangle ($img_source, 0, 0, 150, 30, $bgc);
/* Output an errmsg */
imagestring( $img_source, 1, 5, 5, "Error loading $imgname", $tc);
}
}Clem C
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]