PHP 地图区域图片 (狂想区)

<? php
// +.- ---and all
$OD = ' ipd ' ;
$newwidth   =   80 ;
$newheight   =   80 ;
$bmiparea   =
$files = array (); 
if  ( $handle = opendir ( " $OD " )){
    
while ( false   !==  ( $file   =   readdir ( $handle ))) {
        
if  ( $file   !=   " . "   &&   $file   !=   " .. " ) {
            
if ( substr ( $file ,- 3 ) == ' png ' )
                
$files [ count ( $files )]  =   $file ;
            }
        }
    }
closedir ( $handle );
$random   =   rand ( 0 , count ( $files ) - 1 );
$im   =  imagecreate (  155 ,   138  );
// imagefilledrectangle ( $im, 0, 0, 255, 255, 0);
$source   =  imagecreatefrompng( ' ipd/ ' . $files [ $random ]);
list ( $oldwidth ,   $oldheight =   getimagesize ( ' ipd/ ' . $files [ $random ]);
$bg   =  imagecolorallocate( $im ,   255 ,   255 ,   255 );
$textcolor   =  imagecolorallocate( $im ,   0 ,   0 ,   0 );
imagecopyresized(
$im , $source , 30 , 35 , 0 , 0 , $newwidth , $newheight , $oldwidth , $oldheight );
// imagerectangle($im,30,20,120,98,$file);
$NM   =   ' Dosnake@Gmail.com ' ;
$by   =   ' YOUR IP REGION: ' ;
$IP   =   $_SERVER [ ' REMOTE_ADDR ' ];
imagestring(
$im ,   5 ,   0.2 ,   0 ,   " $NM " ,   $textcolor );
imagestring(
$im ,   4 ,   13 ,   15 ,   " $by " ,   $textcolor );   
imagestring(
$im ,   4 ,   5 ,   123 ,   " IP: $IP " ,   $textcolor );
header ( " Content-type: image/png " );
imagepng(
$im );
imagedestroy(
$im );
?>    

//0x001  一个根据IP显示图片的框架
//0x002     程序很easy,没遇到什么问题
//0x003  主要是在覆盖方面的顺序一直没有掌握好。
//0x004  继续完善中...  存档

转载于:https://www.cnblogs.com/lsk/archive/2008/05/17/1201430.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值