<?php
/** 
 * UQ云商：	www.uqcms.com  
 * 联系QQ：	2200631718 
 * 可免费商用，需要留UQ云商链接作为交换，只首页底部留取即可，不影响使用。
 */
  defined('IN_UQ') or exit('Access Denied'); class vcode { function __construct($uq0 = '100', $uq1 = '36') { $this->width = $uq0; $this->height = $uq1; $this->font = array( UQCMS_PATH.'public/font/lucon.ttf' ); } function create_bg() { $this->images = imagecreatetruecolor($this->width,$this->height); $uq2 = imagecolorallocate($this->images, mt_rand(237,255), mt_rand(253,255), mt_rand(247,255)); imagerectangle($this->images, 0, 0, 1, 1, $uq2); imagefilledrectangle($this->images, 0, $this->height, $this->width,0 ,$uq2); } private function create_font() { $uq3 = strlen($this->code); $uq4 = ($this->width) / $uq3; for($uq5=0;$uq5 < $uq3;$uq5++){ $uq6 = imagecolorallocate($this->images, mt_rand(10,76), mt_rand(95,174), mt_rand(167,240)); imagettftext($this->images, '20', mt_rand(-10,10), $uq5*20+ mt_rand(1,10), $this->height-8, $uq6, $this->font[array_rand($this->font)], $this->code[$uq5] ); } } function get_img($uq7) { $this->code = $uq7; $this->create_bg(); $this->create_font(); header('Content-type:image/png'); imagepng($this->images); imagedestroy($this->images); } private static $uq8; public static function init(){ if (is_null(self::$uq8)){ self::$uq8 = new self(); } return self::$uq8; } } 