Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> PHP

Hàm imageflip() trong PHP

imageflip() lật ảnh theo chiều ngang, dọc, hoặc cả hai.

Cú pháp

imageflip(resource $image, int $mode): bool

Mode

  • IMG_FLIP_HORIZONTAL: Lật ngang (trái-phải).
  • IMG_FLIP_VERTICAL: Lật dọc (trên-dưới).
  • IMG_FLIP_BOTH: Lật cả hai.

Ví dụ: Lật ngang

<?php
$img = imagecreatefrompng('https://example.com/logo.png');
imageflip($img, IMG_FLIP_HORIZONTAL);
header('Content-Type: image/png');
imagejpeg($img);
imagedestroy($img);
?>