close

 

<?php
// 創建圖像的句柄
$im = imagecreatetruecolor(200, 200);

// 分配顏色
$black = imagecolorallocate($im, 0, 0, 0);
$white = imagecolorallocate($im, 255, 255, 255);

// 載入 PostScript 字體
$font = imagepsloadfont('font.pfm');

// 設置文本方框
$bbox = imagepsbbox('Sample text is simple', $font, 12);

// 定義 X 和 Y
$x = ($bbox[2] / 2) - 10;
$y = ($bbox[3] / 2) - 10;

// 字體寫入圖像
imagepstext($im, 'Sample text is simple', $font, 12, $black, $white, $x, $y);

// 輸出並釋放內存
header('Content-type: image/png');

imagepng($im);
imagedestroy($im);
?>

arrow
arrow
    全站熱搜

    stockwfj3 發表在 痞客邦 留言(0) 人氣()