Problems and Solutions when using PHP to dynamically generate gif images

Source: Internet
Author: User
When using PHP to dynamically generate gif files, read the problems and solutions when using PHP to dynamically generate gif files. PHP does not specify to output only html files, it can generate dynamic gif files. I encountered some problems when using php to dynamically generate gif images. now I am using php4.05 (forwin32) + apache3.1.2 _ win32. Q "> <LI

PHP does not specify to output only html files. it can generate dynamic gif files. I encountered some problems when using php to dynamically generate gif images. now I am using php4.05 (for win32) + apache3.1.2 _ win32.

Problem 1: The program that dynamically generates gif cannot be converted.

I wrote an example about using php to generate gif files and run it. I found that the page could not be flushed, as if it were dead, and there was no error message in the browser.

Solution: modify php. ini in the directory where php is located.

Modify php. ini in the path where php is installed (note: php. ini in the php path must be used) extension_dir = the path to install php extensions (for example, c: phpextensions ).

Problem 2: php_gd.dll does not support gif

I loaded the php_gd.dll dynamic connection Library dl ("php_gd.dll") at the beginning of the program. However, when running the program, the following result is displayed:


Warning: ImageGif: No GIF support in this PHP build inD: apachehtdocsgif2.php3On line12
.

Solution: Use php4.05

At this time, I found that the problem in the book is that php_gd.dll does not support generating gif at all. it is only through the guidance of senior people that my version php4.04 for win32 lacks php_gd_gif.dll, so I downloaded a later version of php4.05, which supports generating dynamic gif php_gd_gif.dll.

Problem 3: Warning: Function registration failed-duplicate name-imagearc in d: apachehtdocsgif2.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 );
$ White = imagecolorallocate ($ im, 255,255,255 );
Imageline ($ im, $ white );
Imagestring ($ im, 5, 4, 10, "This is a Gif", $ white );
Imagegif ($ im );
Imagedestroy ($ im );
?>

Solution: modify the program or php. ini
The dl () function is used to load the dll, but if ";" is removed before the required dll in the php. ini file, do not use this function.
If ";" Before extension = php_gd_gif.dll in The INI file is not included, use dl ("php_gd_gif.dll") to load the file. In short, the two are different from each other, otherwise, the server considers the name to be repeated.

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.