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

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


ฟังก์ชัน imageflip() พลิกภาพตามโหมดที่ระบุ

ไวยากรณ์

bool imageflip(img, mode)

พารามิเตอร์

  • img: Image resource จาก imagecreatetruecolor()
  • mode: โหมดการพลิก
    • IMG_FLIP_HORIZONTAL – พลิกแนวนอน
    • IMG_FLIP_VERTICAL – พลิกแนวตั้ง
    • IMG_FLIP_BOTH – พลิกทั้งสองแนว

คืนค่า

TRUE สำเร็จ FALSE ล้มเหลว

ตัวอย่าง: พลิกแนวนอน

<?php 
$img_file = 'https://www.tutorialspoint.com/images/tp-logo-diamond.png'; 
header('Content-type: image/png'); 
$img = imagecreatefrompng($img_file); 
imageflip($img, IMG_FLIP_HORIZONTAL); 
imagejpeg($img); 
imagedestroy($img); 
?>

ผลลัพธ์

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