亚洲国产日韩欧美一区二区三区,精品亚洲国产成人av在线,国产99视频精品免视看7,99国产精品久久久久久久成人热,欧美日韩亚洲国产综合乱

Gambar output tutorial tera air teks pembangunan PHP

Imej output

<?php
     /*打開圖片*/
     //1.配置圖片路徑(填入你的圖片路徑)
     $src="https://img.php.cn/upload/course/000/000/004/581454f755fb1195.jpg";
     //獲取圖片信息
     $info = getimagesize($src);
     //通過圖像的編號(hào)來(lái)獲取圖像的類型
     $type=image_type_to_extension($info[2],false);
     //在內(nèi)存中創(chuàng)建一個(gè)和我們圖像類型一樣的圖像
     $fun = "imagecreatefrom{$type}";
     //把圖片復(fù)制到我們的內(nèi)存中
     $image=$fun($src);
    /*操作圖片*/
     //設(shè)置字體的路徑
     $font="/tpl/Index/Static/css/img/fonts/Christmas.ttf";
     //添加內(nèi)容
     $content="歡迎來(lái)到php中文網(wǎng)";
     //設(shè)置字體的顏色和透明度
     $col=imagecolorallocatealpha($image,255,255,255,30);
     //寫入文字
     imagettftext($image,20,0,20,30,$col,$font,$content);
     /*輸出圖片*/
     //瀏覽器輸出
     header("Content-type:".$info['mime']);
     $func="image{$type}";
     $func($image);
     //保存圖片
     $func($image,'FFF.'.$type);
     /*銷毀圖片*/
     imagedestroy($image);
 ?>
rrree

Tentukan pembolehubah $func.

Output terus daripada penyemak imbas.

Atau simpan output imej dengan nama tersuai.

Dengan cara ini, penambahan tera air teks pada imej selesai.

Meneruskan pembelajaran
||
<?php /*打開圖片*/ //1.配置圖片路徑(填入你的圖片路徑) $src="https://img.php.cn/upload/course/000/000/004/581454f755fb1195.jpg"; //獲取圖片信息 $info = getimagesize($src); //通過圖像的編號(hào)來(lái)獲取圖像的類型 $type=image_type_to_extension($info[2],false); //在內(nèi)存中創(chuàng)建一個(gè)和我們圖像類型一樣的圖像 $fun = "imagecreatefrom{$type}"; //把圖片復(fù)制到我們的內(nèi)存中 $image=$fun($src); /*操作圖片*/ //設(shè)置字體的路徑 $font="/tpl/Index/Static/css/img/fonts/Christmas.ttf"; //添加內(nèi)容 $content="歡迎來(lái)到php中文網(wǎng)"; //設(shè)置字體的顏色和透明度 $col=imagecolorallocatealpha($image,255,255,255,30); //寫入文字 imagettftext($image,20,0,20,30,$col,$font,$content); /*輸出圖片*/ //瀏覽器輸出 header("Content-type:".$info['mime']); $func="image{$type}"; $func($image); //保存圖片 $func($image,'FFF.'.$type); /*銷毀圖片*/ imagedestroy($image); ?>