Home  >  Article  >  Backend Development  >  How to display IP address in pictures in php_PHP tutorial

How to display IP address in pictures in php_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 17:40:031151browse

PHP code:

 

 $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);

 ?>

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/486261.htmlTechArticlePHP code: $img = ImageCreate(180,50); $ip = $_SERVER[REMOTE_ADDR]; ImageColorTransparent( $img,$bgcolor); $bgColor = ImageColorAllocate($img, 0x2c,0x6D,0xAF); // Background color $shad...
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