3 Star 1 Fork 0

lvyasen/erp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
test.php 6.02 KB
一键复制 编辑 原始数据 按行查看 历史
lvyasen 提交于 2019-12-03 13:54 . init
<?php
echo "<pre>";
echo phpinfo();
die();
ini_set('display_errors', 1);
//header("Content-type: image/gif");
//$im =imagecreate(600,200);
//$background_color = ImageColorAllocate ($im, 255, 255, 200);
//$col = imagecolorallocate($im, 0, 51, 102);
//$font="/srv/www/erp/fz.TTF"; //字体所放目录
//
//$come=iconv("gb2312","utf-8","水火不容");
//imagettftext($im,100,0,30,150,$col,$font,$come); //写 TTF 文字到图中
//imagegif($im,'new.gif');
//imagedestroy($im);
//
//
//die();
function generateImg($source, $text1, $text2, $text3, $font = './msyhbd.ttf') {
$date = '' . date ( 'Ymd' ) . '/';
$img = $date . md5 ( $source . $text1 . $text2 . $text3 ) . '.jpg';
if (file_exists ( './' . $img )) {
return $img;
}
$main = imagecreatefromjpeg ( $source );
$width = imagesx ( $main );
$height = imagesy ( $main );
$target = imagecreatetruecolor ( $width, $height );
$white = imagecolorallocate ( $target, 255, 255, 255 );
imagefill ( $target, 0, 0, $white );
imagecopyresampled ( $target, $main, 0, 0, 0, 0, $width, $height, $width, $height );
$fontSize = 18;//像素字体
$fontColor = imagecolorallocate ( $target, 255, 0, 0 );//字的RGB颜色
$fontBox = imagettfbbox($fontSize, 0, $font, $text1);//文字水平居中实质
imagettftext ( $target, $fontSize, 0, ceil(($width - $fontBox[2]) / 2), 190, $fontColor, $font, $text1 );
$fontBox = imagettfbbox($fontSize, 0, $font, $text2);
imagettftext ( $target, $fontSize, 0, ceil(($width - $fontBox[2]) / 2), 370, $fontColor, $font, $text2 );
$fontBox = imagettfbbox($fontSize, 0, $font, $text3);
imagettftext ( $target, $fontSize, 0, ceil(($width - $fontBox[2]) / 2), 560, $fontColor, $font, $text3 );
//imageantialias($target, true);//抗锯齿,有些PHP版本有问题,谨慎使用
imagefilledpolygon ( $target, array (10 + 0, 0 + 142, 0, 12 + 142, 20 + 0, 12 + 142), 3, $fontColor );//画三角形
imageline($target, 100, 200, 20, 142, $fontColor);//画线
imagefilledrectangle ( $target, 50, 100, 250, 150, $fontColor );//画矩形
//bof of 合成图片
$child1 = imagecreatefromjpeg ( 'http://gtms01.alicdn.com/tps/i1/T1N0pxFEhaXXXxK1nM-357-88.jpg' );
imagecopymerge ( $target, $child1, 0, 400, 0, 0, imagesx ( $child1 ), imagesy ( $child1 ), 100 );
//eof of 合成图片
@mkdir ( './' . $date );
imagejpeg ( $target, './' . $img, 95 );
imagedestroy ( $main );
imagedestroy ( $target );
imagedestroy ( $child1 );
return $img;
}
generateImg ( 'https://ssl.picture.qingger.com/Fi8zMItS5c_Uvm7WueZ5z_0VsDg_', 'aaaaa', 'PHP文字水平居中', '3个字' );
exit ();
$system_path = 'system';
$application_folder = 'application';
$view_folder = '';
// Set the current directory correctly for CLI requests
if(defined('STDIN')){
chdir(dirname(__FILE__));
}
if(($_temp = realpath($system_path)) !== FALSE){
$system_path = $_temp . DIRECTORY_SEPARATOR;
}else {
// Ensure there's a trailing slash
$system_path = strtr(
rtrim($system_path, '/\\'),
'/\\',
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
) . DIRECTORY_SEPARATOR;
}
// Is the system path correct?
if(!is_dir($system_path)){
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
echo 'Your system folder path does not appear to be set correctly. Please open the following file and correct this: ' . pathinfo(__FILE__, PATHINFO_BASENAME);
exit(3); // EXIT_CONFIG
}
/*
* -------------------------------------------------------------------
* Now that we know the path, set the main path constants
* -------------------------------------------------------------------
*/
// The name of THIS file
define('SELF', pathinfo(__FILE__, PATHINFO_BASENAME));
// Path to the system directory
define('BASEPATH', $system_path);
// Path to the front controller (this file) directory
define('FCPATH', dirname(__FILE__) . DIRECTORY_SEPARATOR);
// Name of the "system" directory
define('SYSDIR', basename(BASEPATH));
// The path to the "application" directory
if(is_dir($application_folder)){
if(($_temp = realpath($application_folder)) !== FALSE){
$application_folder = $_temp;
}else {
$application_folder = strtr(
rtrim($application_folder, '/\\'),
'/\\',
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
);
}
}elseif(is_dir(BASEPATH . $application_folder . DIRECTORY_SEPARATOR)) {
$application_folder = BASEPATH . strtr(
trim($application_folder, '/\\'),
'/\\',
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
);
}else {
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
echo 'Your application folder path does not appear to be set correctly. Please open the following file and correct this: ' . SELF;
exit(3); // EXIT_CONFIG
}
define('APPPATH', $application_folder . DIRECTORY_SEPARATOR);
// The path to the "views" directory
if(!isset($view_folder[0]) && is_dir(APPPATH . 'views' . DIRECTORY_SEPARATOR)){
$view_folder = APPPATH . 'views';
}elseif(is_dir($view_folder)) {
if(($_temp = realpath($view_folder)) !== FALSE){
$view_folder = $_temp;
}else {
$view_folder = strtr(
rtrim($view_folder, '/\\'),
'/\\',
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
);
}
}elseif(is_dir(APPPATH . $view_folder . DIRECTORY_SEPARATOR)) {
$view_folder = APPPATH . strtr(
trim($view_folder, '/\\'),
'/\\',
DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR
);
}else {
header('HTTP/1.1 503 Service Unavailable.', TRUE, 503);
echo 'Your view folder path does not appear to be set correctly. Please open the following file and correct this: ' . SELF;
exit(3); // EXIT_CONFIG
}
define('VIEWPATH', $view_folder . DIRECTORY_SEPARATOR);
/*
* --------------------------------------------------------------------
* LOAD THE BOOTSTRAP FILE
* --------------------------------------------------------------------
*
* And away we go...
*/
require_once BASEPATH . 'core/CodeIgniter.php';
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
PHP
1
https://gitee.com/lvyasen/erp.git
git@gitee.com:lvyasen/erp.git
lvyasen
erp
erp
master

搜索帮助