查看文件: ajax_makelogo_ud.php
大小: 2.32 KB
类型: application/octet-stream
<?php //logo_0000001.png //if(!isset($_SESSION['shop_name'])){ // $_SESSION['shop_name']="SKYBNI"; // $_SESSION['shop_id']=1; // shop name company ID //} $shop=isset($_POST['shopname'])?trim($_POST['shopname']):'1'; //$_SESSION['shop_name'] ; $word = '-1'; $word1= '-1'; if($shop==1){ $word= trim($_POST['title']) ; }else{ $word1= trim($_POST['title']) ; } // $word=isset($_POST['shopname'])?trim($_POST['shopname']):'-1'; //$_SESSION['shop_name'] ; // $word1=isset($_POST['shopname1'])?trim($_POST['shopname1']):'-1'; //$_SESSION['shop_name'] ; $id=isset($_POST['id'])?trim($_POST['id']):0;// $_SESSION['shop_id'] ; $imgpath1='/www2/skybni/shop/img/'; $imgpath2='/www2/skybni/shop/ext/'; if($word<>'-1' && $id>0){ $im = imagecreatetruecolor(125, 24); ;//imagecreate(125,24); imagesavealpha($im, true); $scolor = imagecolorallocatealpha($im, 0, 0, 0, 127); imagefill($im, 0, 0, $scolor); $wcolor = ImageColorAllocate($im, 28,22,225); $fontsize=16; $myfont="/www2/skybni/fonts/kaiu.ttf"; $top=0; $fontBox = imagettfbbox($fontsize,$top, $myfont,$word); while ( $fontBox[2]>125) { $fontsize=$fontsize-1; $top++; $fontBox = imagettfbbox($fontsize,0, $myfont,$word); } $top= ceil($top/2) ; imagettftext($im,$fontsize,0,ceil((125-$fontBox[2])/ 2),18-$top, $wcolor,$myfont,$word); $img='logo_'.sprintf('%07d', $id ).".png"; imagepng($im,$imgpath1.$img); imagedestroy($im); } if($word1<>'-1' && $id>0 ){ $im2 = imagecreatetruecolor(125, 24); ;//imagecreate(125,24); imagesavealpha($im2, true); $scolor = imagecolorallocatealpha($im2, 0, 0, 0, 127); imagefill($im2, 0, 0, $scolor); $wcolor = ImageColorAllocate($im2, 28,22,225); $fontsize=16; $myfont="/www2/skybni/fonts/kaiu.ttf"; $top=0; $fontBox = imagettfbbox($fontsize,0, $myfont,$word1); while ( $fontBox[2]>125) { $fontsize=$fontsize-1; $top++; $fontBox = imagettfbbox($fontsize,0, $myfont,$word1); } $top= ceil($top/2) ; imagettftext($im2,$fontsize,0,ceil((125-$fontBox[2])/ 2),18-$top, $wcolor,$myfont,$word1); $img='elogo_'.sprintf('%07d', $id ).".png"; imagepng($im2,$imgpath2.$img); imagedestroy($im2); } ?>
保存
取消
返回文件列表