Home >php教程 >php手册 >“支付宝十年账单日记”在线生成器

“支付宝十年账单日记”在线生成器

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-06-06 19:36:522508browse

2014年12月8号,支付宝十年纪念日,在支付宝客户端出现“十年账单日记”的分享,网络纷纷表示是剁手账单。 但是,有部分支付宝用户,可能看着自己花钱数目太少,是在不好意思分享给朋友! 本工具正是基于这个原因发布,简化大家装逼的难度! 工具网页Demo:ht

2014年12月8号,支付宝十年纪念日,在支付宝客户端出现“十年账单日记”的分享,网络纷纷表示是剁手账单。
但是,有部分支付宝用户,可能看着自己花钱数目太少,是在不好意思分享给朋友!
本工具正是基于这个原因发布,简化大家装逼的难度!

工具网页Demo:http://www.atool.org/alipay_ten_year.php

另外支付宝10年活动的另外一个代码开源,其实也挺简单的,也是一个php gd:https://github.com/hustcc/alipay-ten-year

部署在sae上面的,大家随意调用!
<?php
/*
 * for http://www.atool.org/alipay_ten_year.php
 */
$text = array();
$text[] = isset($_GET['t1']) ? trim($_GET['t1']) : '';
$text[] = isset($_GET['t2']) ? trim($_GET['t2']) : '';

if (empty($text[0]) && empty($text[1])) {
	$text[0] = '7,953,258.85';
	$text[1] = '715.82';
}

$img_src = isset($_GET['sy']) ? 'res/weibo/alipay_ten_year.jpg' : 'res/weibo/alipay_ten_year.jpg';

$font_size = 40;

$font = isset($_GET['font']) ? $_GET['font'] : '0';
$font_src = 'res/font/msyhbd.ttf';

$image = imagecreatefromjpeg($img_src);
header("content-type:image/jpeg");

imagealphablending($image, true);

$pos_pay = array(116, 260);
$pos_earn = array(116, 339);

write_all($image, $text[0], $text[1]);

unset($ttf_im);
imagejpeg($image);
imagedestroy($image);



function write_all($image, $pay, $earn) {
	Global $font_size;
	$sy_color = imagecolorallocate($image, 201, 234, 129);
	
	$width_pay = write_pay_num($image, $pay, $sy_color);
	$width_pay = $width_pay[2] - $width_pay[0];
	
	$sy_color = imagecolorallocate($image, 226, 98, 37);
	$width_earn = write_earn_num($image, $earn, $sy_color);
	$width_earn = $width_earn[2] - $width_earn[0];
	
	$sy_color = imagecolorallocate($image, 255, 252, 255);
	write_yuan($image, $sy_color, $width_pay, $width_earn);
}

//写入花钱和赚钱,返回他们的宽度
function write_pay_num($image, $text, $sy_color) {
	Global $font_size, $font_src, $pos_pay; 
	$ttf_im = imagettfbbox($font_size, 0, $font_src, $text);
	imagettftext($image, $font_size, 0, $pos_pay[0], $pos_pay[1], $sy_color, $font_src, $text);
	
	return $ttf_im;
}

function write_earn_num($image, $text, $sy_color) {
	Global $font_size, $font_src, $pos_earn; 
	$ttf_im = imagettfbbox($font_size, 0, $font_src, $text);
	imagettftext($image, $font_size, 0, $pos_earn[0], $pos_earn[1], $sy_color, $font_src, $text);
	
	return $ttf_im;
}

function write_yuan($image, $sy_color, $width_pay, $width_earn) {
	Global $font_size, $font_src, $pos_pay, $pos_earn;
	$font_size = 20;
	imagettftext($image, $font_size, 0, $pos_pay[0] + $width_pay + 15 , $pos_pay[1] - 2, $sy_color, $font_src, '元');
	imagettftext($image, $font_size, 0, $pos_earn[0] + $width_earn + 15, $pos_earn[1] - 2, $sy_color, $font_src, '元');
}
?>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn