Use PHP to create a GIF

Source: Internet
Author: User

PHP is not just used to create HTML output. It can also be used to create GIF image files, or even make GIF image streams easier. To do this, you need to use the GD function library to compile the PHP source file.
Example 2-2. Use PHP to create a GIF File
Header ("Content-type: image/gif ");
$ String = implode ($ argv ,"");
$ Im = imagecreatefromgif ("images/button1.gif ");
$ Orange = ImageColorAllocate ($ im, 220,210, 60 );
$ Px = (imagesx ($ im)-7.5 * strlen ($ string)/2;
ImageString ($ im, 3, $ px, 9, $ string, $ orange );
ImageGif ($ im );
ImageDestroy ($ im );
?>
This example will be called by a page using a method similar. The script for button. php3 will overwrite the text in the basic graph (here "images/button1.gif") and then output the result graph. This is a simple method to prevent you from re-drawing the button image whenever you want to change the text of the key. In this way, they will be dynamically used.

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.