Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> PHP

ฟังก์ชัน imagecreatetruecolor() ใน PHP


ฟังก์ชัน imagecreatetruecolor() สร้างภาพ true color ใหม่

ไวยากรณ์

imagecreatetruecolor (width, height)

พารามิเตอร์

  • width: ความกว้างของภาพ
  • height: ความสูงของภาพ

คืนค่า

คืน resource identifier ของภาพ หากสำเร็จ FALSE หากล้มเหลว

ตัวอย่าง

<?php 
$img = imagecreatetruecolor(600, 500); 
echo imagesy($img); 
echo "<br>"; 
echo imagesx($img); 
?>

ผลลัพธ์

500 600

ตัวอย่างเพิ่มเติม

<?php 
$img = imagecreatetruecolor(300, 450); 
echo imagesy($img); 
echo "<br>"; 
echo imagesx($img); 
?>

ผลลัพธ์

450 300