作者 Cool
1 个管道 的构建 通过 耗费 0 秒

海报功能优化

... ... @@ -549,110 +549,71 @@ class Mycenter extends Api
}
break;
case 2:
if(mb_strlen($list[0]) > 24) {
$i = 1000;
$a = mb_strlen($list[0]);
$b = mb_strlen($list[1]);
if($a < 24 && $b < 24) { //11
$i = 955;
$i+=100;
$arr = explode('--',$list[0]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[1]) > 24) {
$i+=50;
$arr = explode('--',$list[1]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
} else {
$i+=50;
$image->text($list[1],$ttf,18,[0,0,0,20],[10,$i]);
}
} else {
$i = 995;
} elseif($a < 24 && $b > 24) { //12
$i = 945;
$i+=100;
$image->text($list[0],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[1]) > 24) {
} elseif($a > 24 && $b < 24) { //21
$i = 945;
$i+=100;
} else { //22
$i = 935;
$i+=100;
}
foreach ($list as $key => $value){
$i+=50;
$arr = explode('--',$list[1]);
if(mb_strlen($value) > 24) {
$arr = explode('--',$value);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
} else {
$i+=70;
$image->text($list[1],$ttf,18,[0,0,0,20],[10,$i]);
$image->text($value,$ttf,18,[0,0,0,20],[10,$i]);
}
}
break;
case 3:
if(mb_strlen($list[0]) > 24) {//第一条
$i = 970;
$a = mb_strlen($list[0]);
$b = mb_strlen($list[1]);
$c = mb_strlen($list[2]);
if($a < 24 && $b < 24 && $c < 24) { //111
$i = 935;
$i+=100;
$arr = explode('--',$list[0]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[1]) > 24) { // 第二条
$i+=50;
$arr = explode('--',$list[1]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[2]) > 24) { // 第三条
$i+=50;
$arr = explode('--',$list[2]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
} else {
$i+=50;
$image->text($list[2],$ttf,18,[0,0,0,20],[10,$i]);
}
} else {
$i+=50;
$image->text($list[1],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[2]) > 24) {
$i+=50;
$arr = explode('--',$list[2]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
} else {
$i+=50;
$image->text($list[2],$ttf,18,[0,0,0,20],[10,$i]);
}
}
} else {
$i = 985;
} elseif($a < 24 && $b < 24 && $c > 24) { //112
$i = 895;
$i+=100;
} elseif($a < 24 && $b > 24 && $c < 24) { //121
$i = 920;
$i+=100;
} elseif($a < 24 && $b > 24 && $c > 24) { //122
$i = 905;
$i+=100;
} elseif($a > 24 && $b < 24 && $c < 24) { //211
$i = 920;
$i+=100;
} elseif($a > 24 && $b < 24 && $c > 24) { //212
$i = 905;
$i+=100;
} elseif($a > 24 && $b > 24 && $c > 24) { //221
$i = 905;
$i+=100;
} else { //222
$i = 890;
$i+=100;
$image->text($list[0],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[1]) > 24) {
$i+=50;
$arr = explode('--',$list[1]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[2]) > 24) {
$i+=50;
$arr = explode('--',$list[2]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
} else {
$i+=50;
$image->text($list[2],$ttf,18,[0,0,0,20],[10,$i]);
}
} else {
$i+=50;
$image->text($list[1],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[2]) > 24) {
foreach ($list as $key => $value){
$i+=50;
$arr = explode('--',$list[2]);
if(mb_strlen($value) > 24) {
$arr = explode('--',$value);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
} else {
$i+=50;
$image->text($list[2],$ttf,18,[0,0,0,20],[10,$i]);
}
$image->text($value,$ttf,18,[0,0,0,20],[10,$i]);
}
}
// $i = 995;
... ... @@ -663,163 +624,68 @@ class Mycenter extends Api
// $image->text($list[2],$ttf,18,[0,0,0,20],[10,$i]);
break;
case 4:
// $a = mb_strlen($list[0]);
// $b = mb_strlen($list[1]);
// $c = mb_strlen($list[2]);
// $d = mb_strlen($list[3]);
// if($a > 24 && $b < 24 && $c < 24 && $d < 24) {
//
// }
if(mb_strlen($list[0]) > 24) {//第一条
$i = 945;
$a = mb_strlen($list[0]);
$b = mb_strlen($list[1]);
$c = mb_strlen($list[2]);
$d = mb_strlen($list[3]);
if($a < 24 && $b < 24 && $c < 24 && $d < 24) { //1111
$i = 915;
$i+=100;
$arr = explode('--',$list[0]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[1]) > 24) { // 第二条
$i+=50;
$arr = explode('--',$list[1]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[2]) > 24) { // 第三条
$i+=50;
$arr = explode('--',$list[2]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[3]) > 24) { // 第四条
$i+=50;
$arr = explode('--',$list[3]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
} else {
$i+=50;
$image->text($list[3],$ttf,18,[0,0,0,20],[10,$i]);
}
} else {
$i+=50;
$image->text($list[2],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[3]) > 24) { // 第四条
$i+=50;
$arr = explode('--',$list[3]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
} else {
$i+=50;
$image->text($list[3],$ttf,18,[0,0,0,20],[10,$i]);
}
}
} else {
$i+=50;
$image->text($list[1],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[2]) > 24) { // 第三条
$i+=50;
$arr = explode('--',$list[2]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[3]) > 24) { // 第四条
$i+=50;
$arr = explode('--',$list[3]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
} else {
$i+=50;
$image->text($list[3],$ttf,18,[0,0,0,20],[10,$i]);
}
} else {
$i+=50;
$image->text($list[2],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[3]) > 24) { // 第四条
$i+=50;
$arr = explode('--',$list[3]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
} else {
$i+=50;
$image->text($list[3],$ttf,18,[0,0,0,20],[10,$i]);
}
}
}
} else {
$i = 950;
} elseif($a < 24 && $b < 24 && $c < 24 && $d > 24) { //1112
$i = 895;
$i+=100;
} elseif($a < 24 && $b < 24 && $c > 24 && $d < 24) { //1121
$i = 895;
$i+=100;
} elseif($a < 24 && $b < 24 && $c > 24 && $d > 24) { //1122
$i = 880;
$i+=100;
} elseif($a < 24 && $b > 24 && $c < 24 && $d < 24) { //1211
$i = 895;
$i+=100;
} elseif($a < 24 && $b > 24 && $c < 24 && $d > 24) { //1212
$i = 880;
$i+=100;
} elseif($a < 24 && $b > 24 && $c > 24 && $d < 24) { //1221
$i = 880;
$i+=100;
} elseif($a < 24 && $b > 24 && $c > 24 && $d > 24) { //1222
$i = 865;
$i+=100;
} elseif($a > 24 && $b < 24 && $c < 24 && $d < 24) { //2111
$i = 895;
$i+=100;
} elseif($a > 24 && $b < 24 && $c < 24 && $d > 24) { //2112
$i = 880;
$i+=100;
} elseif($a > 24 && $b < 24 && $c > 24 && $d < 24) { //2121
$i = 880;
$i+=100;
} elseif($a > 24 && $b < 24 && $c > 24 && $d > 24) { //2122
$i = 865;
$i+=100;
} elseif($a > 24 && $b > 24 && $c < 24 && $d < 24) { //2211
$i = 880;
$i+=100;
} elseif($a > 24 && $b > 24 && $c < 24 && $d > 24) { //2212
$i = 865;
$i+=100;
} elseif($a > 24 && $b > 24 && $c > 24 && $d < 24) { //2221
$i = 865;
$i+=100;
} else { //2222
$i = 850;
$i+=100;
$image->text($list[0],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[1]) > 24) { // 第二条
$i+=50;
$arr = explode('--',$list[1]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[2]) > 24) { // 第三条
$i+=50;
$arr = explode('--',$list[2]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[3]) > 24) { // 第四条
$i+=50;
$arr = explode('--',$list[3]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
} else {
$i+=50;
$image->text($list[3],$ttf,18,[0,0,0,20],[10,$i]);
}
} else {
$i+=50;
$image->text($list[2],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[3]) > 24) { // 第四条
$i+=50;
$arr = explode('--',$list[3]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
} else {
$i+=50;
$image->text($list[3],$ttf,18,[0,0,0,20],[10,$i]);
}
}
} else {
$i+=50;
$image->text($list[1],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[2]) > 24) { // 第三条
$i+=50;
$arr = explode('--',$list[2]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[3]) > 24) { // 第四条
$i+=50;
$arr = explode('--',$list[3]);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
} else {
$i+=50;
$image->text($list[3],$ttf,18,[0,0,0,20],[10,$i]);
}
} else {
$i+=50;
$image->text($list[2],$ttf,18,[0,0,0,20],[10,$i]);
if(mb_strlen($list[3]) > 24) { // 第四条
foreach ($list as $key => $value){
$i+=50;
$arr = explode('--',$list[3]);
if(mb_strlen($value) > 24) {
$arr = explode('--',$value);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=30;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
} else {
$i+=50;
$image->text($list[3],$ttf,18,[0,0,0,20],[10,$i]);
}
}
$image->text($value,$ttf,18,[0,0,0,20],[10,$i]);
}
}
// $i = 1005;
... ... @@ -832,11 +698,118 @@ class Mycenter extends Api
// $image->text($list[3],$ttf,18,[0,0,0,20],[10,$i]);
break;
default:
$i = 995;
$a = mb_strlen($list[0]);
$b = mb_strlen($list[1]);
$c = mb_strlen($list[2]);
$d = mb_strlen($list[3]);
$e = mb_strlen($list[4]);
if($a < 24 && $b < 24 && $c < 24 && $d < 24 && $e < 24) { //11111
$i = 915;
$i+=100;
} elseif($a < 24 && $b < 24 && $c < 24 && $d < 24 && $e > 24) { //11112
$i = 870;
$i+=100;
} elseif($a < 24 && $b < 24 && $c < 24 && $d > 24 && $e < 24) { //11121
$i = 900;
$i+=100;
} elseif($a < 24 && $b < 24 && $c < 24 && $d > 24 && $e > 24) { //11122
$i = 885;
$i+=100;
} elseif($a < 24 && $b < 24 && $c > 24 && $d < 24 && $e < 24) { //11211
$i = 870;
$i+=100;
} elseif($a < 24 && $b < 24 && $c > 24 && $d < 24 && $e > 24) { //11212
$i = 885;
$i+=100;
} elseif($a < 24 && $b < 24 && $c > 24 && $d > 24 && $e < 24) { //11221
$i = 885;
$i+=100;
} elseif($a < 24 && $b < 24 && $c > 24 && $d > 24 && $e > 24) { //11222
$i = 870;
$i+=100;
} elseif($a < 24 && $b > 24 && $c < 24 && $d < 24 && $e < 24) { //12111
$i = 870;
$i+=100;
} elseif($a < 24 && $b > 24 && $c < 24 && $d < 24 && $e > 24) { //12112
$i = 880;
$i+=100;
} elseif($a < 24 && $b > 24 && $c < 24 && $d > 24 && $e < 24) { //12121
$i = 880;
$i+=100;
} elseif($a < 24 && $b > 24 && $c < 24 && $d > 24 && $e > 24) { //12122
$i = 870;
$i+=100;
} elseif($a < 24 && $b > 24 && $c > 24 && $d < 24 && $e < 24) { //12211
$i = 885;
$i+=100;
} elseif($a < 24 && $b > 24 && $c > 24 && $d < 24 && $e > 24) { //12212
$i = 870;
$i+=100;
} elseif($a < 24 && $b > 24 && $c > 24 && $d > 24 && $e > 24) { //12222
$i = 860;
$i+=100;
} elseif($a > 24 && $b < 24 && $c < 24 && $d < 24 && $e < 24) { //21111
$i = 870;
$i+=100;
} elseif($a > 24 && $b < 24 && $c < 24 && $d < 24 && $e > 24) { //21112
$i = 885;
$i+=100;
} elseif($a > 24 && $b < 24 && $c < 24 && $d > 24 && $e < 24) { //21121
$i = 895;
$i+=100;
} elseif($a > 24 && $b < 24 && $c < 24 && $d > 24 && $e > 24) { //21122
$i = 870;
$i+=100;
} elseif($a > 24 && $b < 24 && $c > 24 && $d < 24 && $e < 24) { //21211
$i = 885;
$i+=100;
} elseif($a > 24 && $b < 24 && $c > 24 && $d < 24 && $e > 24) { //21212
$i = 880;
$i+=100;
} elseif($a > 24 && $b < 24 && $c > 24 && $d > 24 && $e < 24) { //21221
$i = 870;
$i+=100;
} elseif($a > 24 && $b < 24 && $c > 24 && $d > 24 && $e > 24) { //21222
$i = 860;
$i+=100;
} elseif($a > 24 && $b > 24 && $c < 24 && $d < 24 && $e < 24) { //22111
$i = 885;
$i+=100;
} elseif($a > 24 && $b > 24 && $c < 24 && $d < 24 && $e > 24) { //22112
$i = 870;
$i+=100;
} elseif($a > 24 && $b > 24 && $c < 24 && $d > 24 && $e < 24) { //22121
$i = 870;
$i+=100;
} elseif($a > 24 && $b > 24 && $c < 24 && $d > 24 && $e > 24) { //22122
$i = 860;
$i+=100;
} elseif($a > 24 && $b > 24 && $c > 24 && $d < 24 && $e < 24) { //22211
$i = 870;
$i+=100;
} elseif($a > 24 && $b > 24 && $c > 24 && $d < 24 && $e > 24) { //22212
$i = 860;
$i+=100;
} else { //22222
$i = 845;
$i+=100;
}
foreach ($list as $key => $value){
$i+=40;
if(mb_strlen($value) > 24) {
$arr = explode('--',$value);
$image->text($arr[0],$ttf,18,[0,0,0,20],[10,$i]);
$i+=28;
$image->text($arr[1],$ttf,18,[0,0,0,20],[10,$i]);
} else {
$image->text($value,$ttf,18,[0,0,0,20],[10,$i]);
$i+=50;
}
}
// $i = 995;
// foreach ($list as $key => $value){
// $image->text($value,$ttf,18,[0,0,0,20],[10,$i]);
// $i+=50;
// }
break;
}
$image->save(ROOT_PATH.'public/userposter/'.$this->auth->id.'-bg.jpg');
... ...