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