Image Creation

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
zaibe
Forum Newbie
Posts: 6
Joined: Wed Mar 24, 2004 12:10 am

Image Creation

Post by zaibe »

Hello!

i want to creat thumbnail while uploading the picture i'm using a class for that it works fine when i upload a "jpeg" file but it give error when i try to upload a gif file..

Fatal error: Call to undefined function: imagegif()

any body knows y? my gd support is enabled in php.ini...

But i read somewhere tht gif function is no longer working in new versions of gd co'z of some copy rights stuff...

Any one can please help me if any other way to creat thumbnails which can support .gif and jpeg ?

thankx
User avatar
AVATAr
Forum Regular
Posts: 524
Joined: Tue Jul 16, 2002 4:19 pm
Location: Uruguay -- Montevideo
Contact:

Post by AVATAr »

AFAIK PHP can't create gif files (patents stuff) it can read but not create. You have to use third party libraries to do that.
Imagemagic?
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

or you could write your own library... since the standard isn't hard to find... and the patent is supposed to run out this year, last I saw.
User avatar
pickle
Briney Mod
Posts: 6445
Joined: Mon Jan 19, 2004 6:11 pm
Location: 53.01N x 112.48W
Contact:

Post by pickle »

Or, just make the thumbnail a jpeg regardless of the filetype uploaded.
Real programmers don't comment their code. If it was hard to write, it should be hard to understand.
User avatar
launchcode
Forum Contributor
Posts: 401
Joined: Tue May 11, 2004 7:32 pm
Location: UK
Contact:

Post by launchcode »

The GD library you have installed may not have support for GIF creation - the quickest way to find out:

Code: Select all

<?php
	$gd = gd_info();
	if ($gd[5])
	{
		echo "GIF Creation allowed";
	}
?>
If gd_info doesn't work you have a version of PHP less than 4.3.0.
User avatar
anjanesh
DevNet Resident
Posts: 1679
Joined: Sat Dec 06, 2003 9:52 pm
Location: Mumbai, India

Post by anjanesh »

Finally gif write support avaiable in ver 4 and 5 !
http://www.php.net/manual/en/ref.image.php
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. Write support is avaliable since PHP 4.3.9 and PHP 5.0.1.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

thanks for the news flash :roll:
Post Reply