imageflip
Description
Syntax
imageflip( GdImage $image, int $mode ): bool
Parameters
image
A GdImage object, returned by one of the image creation functions, such as imagecreatetruecolor().
mode
Flip mode.
Constant | Description |
---|---|
IMG_FLIP_HORIZONTAL | Flips the image horizontally. |
IMG_FLIP_VERTICAL | Flips the image vertically. |
IMG_FLIP_BOTH | Flips the image both horizontally and vertically. |
Return
Returns true on success or false on failure.
Examples
1 · return
<? $width = 100; $height = 100; $image = imagecreate($width, $height); $mode = IMG_FLIP_HORIZONTAL; $return = imageflip($image, $mode); var_export($return);
true
2 · base64 · mode · IMG_FLIP_HORIZONTAL
<? $width = 100; $height = 100; $image = imagecreatetruecolor($width, $height); $red = 255; $green = 255; $blue = 255; $color = imagecolorallocate($image, $red, $green, $blue); $font = 1; $x = 0; $y = 0; $string = "string"; imagestring($image, $font, $x, $y, $string, $color); $mode = IMG_FLIP_HORIZONTAL; imageflip($image, $mode); ob_start(); imagepng($image); $output = ob_get_clean(); echo '<!doctype html> <html> <body> <img src="data:image/png;base64,' . base64_encode($output) . '"> </body> </html>';
<!doctype html> <html> <body> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAhklEQVR4nO3TQQoDMQgAQO3//2wPpW1wQ3oo7EFmDiFEhURMBJxV1Z8JfG2b9bj/Hjeot/Uklhb8jK5rS57m8OyWsI3GZbIm96uNw2HTquI4gzO/YURkZmZuQ60d18Kq+tS+NpMnK8Y/DwAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAARnkCHGuMh9VYfNwAAAAASUVORK5CYII="> </body> </html>
3 · base64 · mode · IMG_FLIP_VERTICAL
<? $width = 100; $height = 100; $image = imagecreatetruecolor($width, $height); $red = 255; $green = 255; $blue = 255; $color = imagecolorallocate($image, $red, $green, $blue); $font = 1; $x = 0; $y = 0; $string = "string"; imagestring($image, $font, $x, $y, $string, $color); $mode = IMG_FLIP_VERTICAL; imageflip($image, $mode); ob_start(); imagepng($image); $output = ob_get_clean(); echo '<!doctype html> <html> <body> <img src="data:image/png;base64,' . base64_encode($output) . '"> </body> </html>';
<!doctype html> <html> <body> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAjElEQVR4nO3TUQrDIAwAUOP975x9yKRLW9YNxph770OqRjEhbQ0AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPgBmZmZ337Fx+RdWSwfh/FnYavWq0dERLTHzCPiLOERPMa9tTurj/RmyaY5LU1UbNcP71lN+bO23bGv1JXdhZur+qNUX9TfOKOaPHcD2I56qmSdnxsAAAAASUVORK5CYII="> </body> </html>
4 · base64 · mode · IMG_FLIP_BOTH
<? $width = 100; $height = 100; $image = imagecreatetruecolor($width, $height); $red = 255; $green = 255; $blue = 255; $color = imagecolorallocate($image, $red, $green, $blue); $font = 1; $x = 0; $y = 0; $string = "string"; imagestring($image, $font, $x, $y, $string, $color); $mode = IMG_FLIP_BOTH; imageflip($image, $mode); ob_start(); imagepng($image); $output = ob_get_clean(); echo '<!doctype html> <html> <body> <img src="data:image/png;base64,' . base64_encode($output) . '"> </body> </html>';
<!doctype html> <html> <body> <img src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAD/gAIDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAlElEQVR4nO3UywrCMBAF0F7x/395XASjpDXgIgTlnEXpa8L0kulxAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfKGqqmp3F79giKlftpN6+lR1Lm9uq/rdbbKzkvTjZWGSIbgkSe5rWt2vZdG+vN35lN2QzhBiX2dhr3udB60P4PsL86fzmeXlMp2//WfN2SnLPQDU6nevw7VoJgAAAABJRU5ErkJggg=="> </body> </html>
Links
Image
- gd_info
- getimagesize
- getimagesizefromstring
- image_type_to_extension
- image_type_to_mime_type
- imageaffine
- imageaffinematrixconcat
- imageaffinematrixget
- imagealphablending
- imageantialias
- imagearc
- imageavif
- imagebmp
- imagechar
- imagecharup
- imagecolorallocate
- imagecolorallocatealpha
- imagecolorat
- imagecolorclosest
- imagecolorclosestalpha
- imagecolorclosesthwb
- imagecolordeallocate
- imagecolorexact
- imagecolorexactalpha
- imagecolormatch
- imagecolorresolve
- imagecolorresolvealpha
- imagecolorset
- imagecolorsforindex
- imagecolorstotal
- imagecolortransparent
- imageconvolution
- imagecopy
- imagecopymerge
- imagecopymergegray
- imagecopyresampled
- imagecopyresized
- imagecreate
- imagecreatefromavif
- imagecreatefrombmp
- imagecreatefromgif
- imagecreatefromjpeg
- imagecreatefrompng
- imagecreatefromstring
- imagecreatefromtga
- imagecreatefromwbmp
- imagecreatefromwebp
- imagecreatefromxbm
- imagecreatefromxpm
- imagecreatetruecolor
- imagecrop
- imagecropauto
- imagedashedline
- imagedestroy
- imageellipse
- imagefill
- imagefilledarc
- imagefilledellipse
- imagefilledpolygon
- imagefilledrectangle
- imagefilltoborder
- imagefilter
- imagefontheight
- imagefontwidth
- imageftbbox
- imagefttext
- imagegammacorrect
- imagegetclip
- imagegetinterpolation
- imagegif
- imageinterlace
- imageistruecolor
- imagejpeg
- imagelayereffect
- imageline
- imageloadfont
- imageopenpolygon
- imagepalettecopy
- imagepalettetotruecolor
- imagepng
- imagepolygon
- imagerectangle
- imageresolution
- imagerotate
- imagesavealpha
- imagescale
- imagesetbrush
- imagesetclip
- imagesetinterpolation
- imagesetpixel
- imagesetstyle
- imagesetthickness
- imagesettile
- imagestring
- imagestringup
- imagesx
- imagesy
- imagetruecolortopalette
- imagettfbbox
- imagettftext
- imagetypes
- imagewbmp
- imagewebp
- imagexbm
- iptcembed
- iptcparse