Problems and solutions when using PHP to generate GIF dynamically

Source: Internet
Author: User
Tags install php ini modify win32
Dynamic | solve | The problem

PHP does not specify that only HTML files be exported, it can generate animated GIF files. I encountered some problems while using PHP to generate GIF images dynamically, and I have now resolved that I am using php4.05 (for Win32) +apache3.1.2_win32.

Problem One: The program that dynamically generates GIF does not turn up at all

I wrote an example of using PHP to generate GIF, run, found that the page is not brush out, as if it is dead, the browser does not have any error prompts.

Workaround: Modify the php.ini in the directory where PHP resides

Through Osso Network member Selo help, tell me is to modify the installation of PHP under the path of php.ini (note: Must be the PHP path php.ini) extension_dir = install PHP path \extensions (for example: c:\php\ Extensions).

Question two: Php_gd.dll does not support GIF

I loaded the Php_gd.dll Dynamic Connection Library at the beginning of the program: DL ("Php_gd.dll"), but when you run the program, this happens:

<BR><B>WARNING</B>: Imagegif:no GIF Support in-PHP build in <b>d:\apache\htdocs\gif2.php3& Lt;/b> on line <b>12</b><br>.

Solution: Use php4.05

At this time I found that the book is written on the problem Php_gd.dll can not support the production of GIF, after the expert guide to know their version php4.04 for Win32 lack of PHP_GD_ Gif.dll, so I downloaded a newer version of php4.05, which has a php_gd_gif.dll that supports generating animated GIFs.

Question three: A warning appears: Warning:function registration Failed-duplicate Name-imagearc in d:\apache\htdocs\gif2.php3 on line 3

The procedure is as follows:

?
DL ("Php_gd_gif.dll");
Header ("Content-type:image/gif");

$im = Imagecreate (400,30);
$black = Imagecolorallocate ($im, 0,0,0);
$white = Imagecolorallocate ($im, 255,255,255);
Imageline ($im, 200,15,215,15, $white);
Imagestring ($im, 5, 4, "This is a Gif", $white);

Imagegif ($im);
Imagedestroy ($im);


?>

Workaround: Modify the program or php.ini

The DL () function is used to load DLLs, but if the required DLL is in the php.ini file, precede the ";" have been removed, then do not use this function.
If the INI file is extension=php_gd_gif.dll before the ";" No, then use DL ("Php_gd_gif.dll"); load, in short: The two are different, otherwise the server thinks it is a duplicate name.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.