查看文件: market_roadpic.php
大小: 3.24 KB
类型: application/octet-stream
<?php require_once('../Connections/BE2.php'); ?> <?php //$globals = $GLOBALS; function wf_to_nf($strs ){ //全形半形轉換 $wft = array( '一段', '二段', '三段', '四段', '五段', '六段', '七段', '八段', '九段'); $nft = array( "1段", "2段", "3段", "4段", "5段", "6段", "7段", "8段", "9段"); //return str_replace($wft,$nft,$strs); //半形到全形 global $str01 ; global $str02 ; $a1=str_replace($nft,$wft,$strs); //半形到全形 $str01=$a1 ; foreach ($wft as $letter) { if (strpos($a1, $letter) !== false) { //$flag = true; $str01=str_replace($letter,"",$a1); $str02=$letter ; } } return $a1; } mysql_select_db($database_BE2, $BE2); $query_Rt2 = "SELECT * FROM marketstreet where fcc='3' order by mid limit 300" ; $Rt2 = mysql_query($query_Rt2, $BE2) or die(mysql_error()); $row_Rt2 = mysql_fetch_assoc($Rt2); $totalRows_Rt2 = mysql_num_rows($Rt2); do { $vimg=sprintf("%04d",$row_Rt2['mid']).'_'.date('Ymdhis',time()).'.png' ; $savepath = '/www2/skybni/submarket/images/'; $background="/www2/skybni/test007/bb.png"; $myfont="/www2/skybni/fonts/wt009.ttf"; $im = imagecreatefrompng($background); $white = ImageColorAllocate($im, 255,255,255); $point_y=array(105,165,225,285);//high $point_4x=40; $doc1=explode(",",$row_Rt2['maddress_name']); $str01=''; $str02=''; $doc1[2]= wf_to_nf($doc1[2]); //台北市 南港區 南港路1段 單號 $str02 .= $row_Rt2['mside']; //1段單號 $str03 ='網店商城'; $drawstr=array($str01,$str02,'網店商城'); for ($i=0;$i<3;$i++){ $l=mb_strlen($drawstr[$i]); if($l==2){ $word=mb_substr( $drawstr[$i],0,1,"utf-8"); ;//'南港路' ;//substr($authnum,$c,1); ImageTTFText($im,40,0,40,$point_y[$i], $white,$myfont,$word); $word=mb_substr( $drawstr[$i],1,1,"utf-8") ;//'南港路' ;//substr($authnum,$c,1); ImageTTFText($im,40,0,200,$point_y[$i], $white,$myfont,$word); }else if($l==3){ $word=mb_substr( $drawstr[$i],0,1,"utf-8"); ;//'南港路' ;//substr($authnum,$c,1); ImageTTFText($im,40,0,40,$point_y[$i], $white,$myfont,$word); $word=mb_substr( $drawstr[$i],1,1,"utf-8") ;//'南港路' ;//substr($authnum,$c,1); ImageTTFText($im,40,0,120,$point_y[$i], $white,$myfont,$word); $word=mb_substr( $drawstr[$i],2,1,"utf-8") ;//'南港路' ;//substr($authnum,$c,1); ImageTTFText($im,40,0,200,$point_y[$i], $white,$myfont,$word); }else if($l==4){ $word=$drawstr[$i]; ImageTTFText($im,40,0,40,$point_y[$i], $white,$myfont,$word); } } // $vimg=date('Ymdhis',time()).'.png' ; ImagePNG($im, $savepath.$vimg); ImageDestroy($im); $updateSQL = sprintf("UPDATE marketstreet set fcc=4,mpic=%s WHERE mid=%s", GetSQLValueString($vimg, "text"), GetSQLValueString($row_Rt2['mid'], "int")); mysql_select_db($database_BE2, $BE2); mysql_query($updateSQL, $BE2) or die(mysql_error()); // echo $upSQL; } while ($row_Rt2 = mysql_fetch_assoc($Rt2)); mysql_free_result($Rt2); ?>
保存
取消
返回文件列表