mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-05 07:20:58 +08:00
upload preivew + es command
This commit is contained in:
@@ -16,32 +16,32 @@ if($action == "regimage")
|
||||
$space = " ";
|
||||
}
|
||||
$imagestring = $newstring;
|
||||
|
||||
|
||||
if(function_exists("imagecreatefrompng"))
|
||||
{
|
||||
$fontwidth = imageFontWidth(5);
|
||||
$fontheight = imageFontHeight(5);
|
||||
$textwidth = $fontwidth*strlen($imagestring);
|
||||
$textheight = $fontheight;
|
||||
|
||||
|
||||
$randimg = rand(1, 5);
|
||||
$im = imagecreatefrompng("pic/regimages/reg".$randimg.".png");
|
||||
|
||||
|
||||
$imgheight = 40;
|
||||
$imgwidth = 150;
|
||||
$textposh = ($imgwidth-$textwidth)/2;
|
||||
$textposv = ($imgheight-$textheight)/2;
|
||||
|
||||
$textposh = floor(($imgwidth-$textwidth)/2);
|
||||
$textposv = floor(($imgheight-$textheight)/2);
|
||||
|
||||
$dots = $imgheight*$imgwidth/35;
|
||||
$textcolor = null;
|
||||
$gd = imagecreatetruecolor($imgwidth, $imgheight);
|
||||
for($i=1;$i<=$dots;$i++)
|
||||
{
|
||||
imagesetpixel($im, rand(0, $imgwidth), rand(0, $imgheight), $textcolor);
|
||||
imagesetpixel($im, rand(0, $imgwidth), rand(0, $imgheight), imagecolorallocate($gd, rand(0, 255), rand(0, 255), rand(0, 255)));
|
||||
}
|
||||
|
||||
|
||||
$textcolor = imagecolorallocate($im, 0, 0, 0);
|
||||
imagestring($im, 5, $textposh, $textposv, $imagestring, $textcolor);
|
||||
|
||||
|
||||
// output the image
|
||||
header("Content-type: image/png");
|
||||
imagepng($im);
|
||||
|
||||
Reference in New Issue
Block a user