Php text to create and generate image_php tutorial

Source: Internet
Author: User
Create a php text file to generate an image. Php text to create and generate images now many people need to generate text images. Php gd Library allows us to do this. Here we provide a simple method, which is to create an image from the php text file of the image network.

Many people need to generate text images. Php gd Library allows us to do this. Here we provide a simple method, that is, the email address used on the image webpage. Some say this helps keep the email harvester far away, but its optical character recognition is still possible.

// Show the correct header for the image type
Header ("Content-type: image/jpg ");

// An email address in a string
$ String = "email@example.com ";

// Some variables to set
$ Font = 4;
$ Width = ImageFontWidth ($ font) * strlen ($ string );
$ Height = ImageFontHeight ($ font );

// Lets begin by creating an image
$ Im = @ imagecreatetruecolor ($ width, $ height );

// White background
$ Background_color = imagecolorallocate ($ instant, 255,255,255 );

// Black text
$ Text_color = imagecolorallocate ($ im, 0, 0, 0 );

// Put it all together
Imagestring ($ im, $ font, 0, 0, $ string, $ text_color );

// And display
Imagejpeg ($ im );
?>


Http://www.bkjia.com/PHPjc/444985.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/444985.htmlTechArticlephp text creation to generate images now many people want to generate text images. Php gd Library allows us to do this. Here we will give a simple method, which is to put the image network...

Related Article

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.