ฟังก์ชัน imagestringup() ใช้วาดข้อความ (string) แนวตั้ง (vertical) บนรูปภาพ
รูปแบบการใช้งาน (Syntax)
bool imagestringup(GdImage $image, int $font, int $x, int $y, string $string, int $color)
พารามิเตอร์
- $image – GdImage จาก imagecreatetruecolor()
- $font – font size 1-5 สำหรับ built-in fonts หรือ font identifier จาก imageloadfont()
- $x – ตำแหน่งแนวนอน (X-axis) มุมซ้ายบน
- $y – ตำแหน่งแนวตั้ง (Y-axis) มุมบนสุด
- $string – ข้อความที่ต้องการเขียน
- $color – สีของข้อความ
ค่าที่คืนกลับ
คืน true เมื่อสำเร็จ false เมื่อล้มเหลว
ตัวอย่าง
<?php
$img = imagecreatetruecolor(700, 300);
$bgcolor = imagecolorallocate($img, 122, 122, 122);
imagefill($img, 0, 0, $bgcolor);
$textcolor = imagecolorallocate($img, 255, 255, 255);
imagestringup($img, 6, 130, 150, 'Hello World', $textcolor);
header('Content-type: image/png');
imagepng($img);
?>
ผลลัพธ์
