Home  >  Article  >  Backend Development  >  php generate ip on picture_PHP tutorial

php generate ip on picture_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:45:271057browse

In many places we will see IP addresses generated on images. Today we will tell you how to use php to generate IP addresses on images. Well, let’s take a look at examples.

In many places we will see IP addresses generated on pictures. Today we will tell you how to use PHP tutorials to generate IP addresses on pictures. Well, let’s take a look at examples.

$img = imagecreate(180,50);

$ip = $_server['remote_addr'];

imagecolortransparent($img,$bgcolor);

 $bgcolor = imagecolorallocate($img, 0x2c,0x6d,0xaf); // Background color

 $shadow = imagecolorallocate($img, 250,0,0); // Shadow color

 $textcolor = imagecolorallocate($img, oxff,oxff,oxff); // Font color

Imagettftext($img,10,0,78,30,$shadow,"c:/windows/fonts/tahoma.ttf",$ip);

//Show background

Imagettftext($img,10,0,25,28,$textcolor,"c:/windows/fonts/tahoma.ttf","your ip is".$ip);

 //Display ip

imagepng($img);

imagecreatefrompng($img);

imagedestroy($img);

In fact, it uses the image generation function of PHP. This function is often used to generate verification codes.

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/633020.htmlTechArticleIn many places we will see the IP address generated in the picture. Today we will tell you how to use php Generate the IP on the picture. Okay, let's take a look at the example. In...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn