GD
gd_info
<?php
var_dump(gd_info());
getimagesize
<?php
var_dump(getimagesize(__DIR__ . '/example.jpg'));
var_dump(getimagesize('https://github.com/fluidicon.png'));
getimagesizefromstring
<?php
var_dump(getimagesizefromstring(file_get_contents(__DIR__ . '/example.jpg')));
var_dump(getimagesizefromstring(file_get_contents('https://github.com/fluidicon.png')));
image_type_to_extension
<?php
var_dump(image_type_to_extension(IMAGETYPE_GIF));
var_dump(image_type_to_extension(IMAGETYPE_JPEG));
var_dump(image_type_to_extension(IMAGETYPE_PNG));
var_dump(image_type_to_extension(IMAGETYPE_PNG, false));
image_type_to_mime_type
<?php
var_dump(image_type_to_mime_type(IMAGETYPE_GIF));
var_dump(image_type_to_mime_type(IMAGETYPE_JPEG));
var_dump(image_type_to_mime_type(IMAGETYPE_PNG));
imageaffine
<?php
$image = imagecreate(100, 100);
var_dump(imageaffine($image, [1, 0, 0, 1, 0, 0]));
imageaffinematrixconcat
<?php
$foo = imageaffinematrixget(IMG_AFFINE_TRANSLATE, ['x' => 2, 'y' => 3]);
$bar = imageaffinematrixget(IMG_AFFINE_SCALE, ['x' => 4, 'y' => 5]);
var_dump(imageaffinematrixconcat($foo, $bar));
imageaffinematrixget
<?php
var_dump(imageaffinematrixget(IMG_AFFINE_TRANSLATE, ['x' => 2, 'y' => 3]));
var_dump(imageaffinematrixget(IMG_AFFINE_SCALE, ['x' => 4, 'y' => 5]));
imagealphablending
<?php
$image = imagecreate(100, 100);
imagealphablending($image, true);
imagecolorallocate($image, 255, 255, 255);
imagefilledrectangle($image, 30, 30, 70, 70, imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imageantialias
<?php
$foo = imagecreatetruecolor(400, 100);
imagecolorallocate($foo, 0, 0, 0);
imageantialias($foo, true);
imageline($foo, 0, 0, 200, 100, imagecolorallocate($foo, 255, 0, 0));
$bar = imagecreate(200, 100);
imagecolorallocate($bar, 0, 0, 0);
imageline($bar, 0, 0, 200, 100, imagecolorallocate($bar, 255, 0, 0));
imagecopymerge($foo, $bar, 200, 0, 0, 0, 200, 100, 100);
header('Content-Type: image/png');
imagepng($foo);
imagearc
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagearc($image, 50, 50, 50, 50, 0, 360, imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imagebmp
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
header('Content-Type: image/bmp');
imagebmp($image, __DIR__ . '/example.bmp');
imagebmp($image);
imagechar
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagechar($image, 5, 0, 0, 'A', imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imagecharup
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagecharup($image, 5, 0, 10, 'A', imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imagecolorallocate
<?php
$image = imagecreate(100, 100);
var_dump(imagecolorallocate($image, 255, 255, 255));
var_dump(imagecolorallocate($image, 100, 100, 100));
var_dump(imagecolorallocate($image, 0, 0, 0));
imagecolorallocatealpha
<?php
$image = imagecreate(100, 100);
var_dump(imagecolorallocatealpha($image, 255, 255, 255, 127));
var_dump(imagecolorallocatealpha($image, 100, 100, 100, 50));
var_dump(imagecolorallocatealpha($image, 0, 0, 0, 0));
imagecolorat
<?php
var_dump(imagecolorat(imagecreatefromjpeg(__DIR__ . '/example.jpg'), 100, 100));
imagecolorclosest
<?php
$image = imagecreatefromjpeg(__DIR__ . '/example.jpg');
var_dump(imagecolorclosest($image, 255, 255, 255));
imagecolorclosestalpha
<?php
$image = imagecreatefromjpeg(__DIR__ . '/example.jpg');
var_dump(imagecolorclosestalpha($image, 255, 255, 255, 50));
imagecolorclosesthwb
<?php
$image = imagecreatefromjpeg(__DIR__ . '/example.jpg');
var_dump(imagecolorclosesthwb($image, 255, 255, 255));
imagecolordeallocate
<?php
$image = imagecreate(100, 100);
$white = imagecolorallocate($image, 255, 255, 255);
imagecolordeallocate($image, $white);
$black = imagecolorallocate($image, 0, 0, 0);
header('Content-Type: image/png');
imagepng($image);
imagecolorexact
<?php
$image = imagecreatefromjpeg(__DIR__ . '/example.jpg');
var_dump(imagecolorexact($image, 255, 255, 255));
imagecolorexactalpha
<?php
$image = imagecreatefromjpeg(__DIR__ . '/example.jpg');
var_dump(imagecolorexactalpha($image, 255, 255, 255, 50));
imagecolormatch
<?php
$foo = imagecreatetruecolor(100, 100);
$bar = imagecreate(100, 100);
imagecolorallocate($bar, 255, 255, 255);
var_dump(imagecolormatch($foo, $bar));
imagecolorresolve
<?php
$image = imagecreatefromjpeg(__DIR__ . '/example.jpg');
var_dump(imagecolorresolve($image, 255, 255, 255));
imagecolorresolvealpha
<?php
$image = imagecreatefromjpeg(__DIR__ . '/example.jpg');
var_dump(imagecolorresolvealpha($image, 255, 255, 255, 50));
imagecolorset
<?php
$image = imagecreatefromjpeg(__DIR__ . '/example.jpg');
imagecolorset($image, imagecolorat($image, 100, 100), 255, 255, 255);
imagecolorsforindex
<?php
$image = imagecreatefromjpeg(__DIR__ . '/example.jpg');
var_dump(imagecolorsforindex($image, imagecolorat($image, 100, 100)));
imagecolorstotal
<?php
$image = imagecreatefromjpeg(__DIR__ . '/example.jpg');
var_dump(imagecolorstotal($image));
imagecolortransparent
<?php
$image = imagecreatetruecolor(100, 100);
var_dump(imagecolortransparent($image));
imageconvolution
<?php
$image = imagecreatefromjpeg(__DIR__ . '/example.jpg');
imageconvolution($image, [[2, 0, 0], [0, -1, 0], [0, 0, -1]], 1, 127);
header('Content-Type: image/jpg');
imagejpeg($image);
imagecopy
<?php
$foo = imagecreate(100, 100);
imagecolorallocate($foo, 255, 0, 0);
$bar = imagecreate(100, 100);
imagecolorallocate($bar, 0, 255, 0);
imagecopy($foo, $bar, 50, 0, 0, 0, 50, 100);
header('Content-Type: image/png');
imagepng($foo);
imagecopymerge
<?php
$foo = imagecreate(100, 100);
imagecolorallocate($foo, 255, 0, 0);
$bar = imagecreate(100, 100);
imagecolorallocate($bar, 0, 255, 0);
imagecopymerge($foo, $bar, 50, 0, 0, 0, 50, 100, 100);
header('Content-Type: image/png');
imagepng($foo);
imagecopymergegray
<?php
$foo = imagecreate(100, 100);
imagecolorallocate($foo, 255, 0, 0);
$bar = imagecreate(100, 100);
imagecolorallocate($bar, 0, 255, 0);
imagecopymergegray($foo, $bar, 50, 0, 0, 0, 50, 100, 100);
header('Content-Type: image/png');
imagepng($foo);
imagecopyresampled
<?php
$foo = imagecreate(200, 200);
imagecolorallocate($foo, 255, 0, 0);
$bar = imagecreate(100, 100);
imagecolorallocate($bar, 0, 255, 0);
imagecopyresampled($foo, $bar, 0, 0, 0, 0, 200, 200, 100, 100);
header('Content-Type: image/png');
imagepng($foo);
imagecopyresized
<?php
$foo = imagecreate(200, 200);
imagecolorallocate($foo, 255, 0, 0);
$bar = imagecreate(100, 100);
imagecolorallocate($bar, 0, 255, 0);
imagecopyresized($foo, $bar, 0, 0, 0, 0, 200, 200, 100, 100);
header('Content-Type: image/png');
imagepng($foo);
imagecreate
<?php
var_dump(imagecreate(100, 100));
imagecreatefrombmp
<?php
var_dump(imagecreatefrombmp(__DIR__ . '/example.bmp'));
imagecreatefromgd2
<?php
var_dump(imagecreatefromgd2(__DIR__ . '/example.gd2'));
imagecreatefromgd2part
<?php
var_dump(imagecreatefromgd2part(__DIR__ . '/example.gd2', 50, 50, 100, 100));
imagecreatefromgd
<?php
var_dump(imagecreatefromgd(__DIR__ . '/example.gd'));
imagecreatefromgif
<?php
var_dump(imagecreatefromgif(__DIR__ . '/example.gif'));
imagecreatefromjpeg
<?php
var_dump(imagecreatefromjpeg(__DIR__ . '/example.jpg'));
imagecreatefrompng
<?php
var_dump(imagecreatefrompng(__DIR__ . '/example.png'));
imagecreatefromstring
<?php
var_dump(imagecreatefromstring(file_get_contents(__DIR__ . '/example.jpg')));
var_dump(imagecreatefromstring(file_get_contents('https://github.com/fluidicon.png')));
imagecreatefromwbmp
<?php
var_dump(imagecreatefromwbmp(__DIR__ . '/example.wbmp'));
imagecreatefromwebp
<?php
var_dump(imagecreatefromwebp(__DIR__ . '/example.webp'));
imagecreatefromxbm
<?php
var_dump(imagecreatefromxbm(__DIR__ . '/example.xbm'));
imagecreatefromxpm
<?php
var_dump(imagecreatefromxpm(__DIR__ . '/example.xpm'));
imagecreatetruecolor
<?php
var_dump(imagecreatetruecolor(100, 100));
imagecrop
<?php
var_dump(imagecrop(imagecreatefromjpeg(__DIR__ . '/example.jpg'), ['x' => 0, 'y' => 0, 'width' => 100, 'height' => 100]));
imagecropauto
<?php
var_dump(imagecropauto(imagecreatefromjpeg(__DIR__ . '/example.jpg'), IMG_CROP_DEFAULT));
imagedashedline
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagedashedline($image, 0, 0, 100, 100, imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imagedestroy
<?php
var_dump(imagedestroy(imagecreate(100, 100)));
imageellipse
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imageellipse($image, 50, 50, 50, 50, imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imagefill
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagefill($image, 0, 0, imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imagefilledarc
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagefilledarc($image, 50, 50, 50, 50, 0, 360, imagecolorallocate($image, 0, 0, 0), IMG_ARC_PIE);
header('Content-Type: image/png');
imagepng($image);
imagefilledellipse
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagefilledellipse($image, 50, 50, 50, 50, imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imagefilledpolygon
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagefilledpolygon($image, [20, 30, 50, 10, 80, 30, 70, 85, 30, 85], 5, imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imagefilledrectangle
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagefilledrectangle($image, 20, 20, 80, 80, imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imagefilltoborder
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
$black = imagecolorallocate($image, 0, 0, 0);
imageline($image, 80, 0, 80, 100, $black);
imagefilltoborder($image, 0, 0, $black, imagecolorallocate($image, 255, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imagefilter
<?php
$image = imagecreatefromjpeg(__DIR__ . '/example.jpg');
imagefilter($image, IMG_FILTER_NEGATE);
header('Content-Type: image/jpg');
imagejpeg($image);
imageflip
<?php
$image = imagecreatefromjpeg(__DIR__ . '/example.jpg');
var_dump(imageflip($image, IMG_FLIP_HORIZONTAL));
var_dump(imageflip($image, IMG_FLIP_VERTICAL));
var_dump(imageflip($image, IMG_FLIP_BOTH));
imagefontheight
<?php
var_dump(imagefontheight(1));
var_dump(imagefontheight(2));
var_dump(imagefontheight(3));
imagefontwidth
<?php
var_dump(imagefontwidth(1));
var_dump(imagefontwidth(2));
var_dump(imagefontwidth(3));
imageftbbox
<?php
var_dump(imageftbbox(20, 0, 'Arial.ttf', 'foo'));
imagefttext
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagefttext($image, 20, 0, 20, 50, imagecolorallocate($image, 0, 0, 0), 'Arial.ttf', 'foo');
header('Content-Type: image/png');
imagepng($image);
imagegammacorrect
<?php
$image = imagecreatefromjpeg(__DIR__ . '/example.jpg');
imagegammacorrect($image, 1, 2);
header('Content-Type: image/jpg');
imagejpeg($image);
imagegd2
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagegd2($image, __DIR__ . '/example.gd2');
imagegd
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagegd($image, __DIR__ . '/example.gd');
imagegetclip
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagesetclip($image, 20, 20, 80, 80);
var_dump(imagegetclip($image));
imagegif
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
header('Content-Type: image/gif');
imagegif($image);
imagegif($image, __DIR__ . '/example.gif');
imagegrabscreen
<?php
$image = imagegrabscreen();
header('Content-Type: image/png');
imagepng($image);
imageinterlace
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
var_dump(imageinterlace($image));
var_dump(imageinterlace($image, 1));
var_dump(imageinterlace($image, 0));
imageistruecolor
<?php
$image = imagecreate(100, 100);
var_dump(imageistruecolor($image));
$image = imagecreatetruecolor(100, 100);
var_dump(imageistruecolor($image));
imagejpeg
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
header('Content-Type: image/jpg');
imagejpeg($image);
imagejpeg($image, __DIR__ . '/example.jpg');
imagelayereffect
<?php
$image = imagecreatefromjpeg(__DIR__ . '/example.jpg');
imagelayereffect($image, IMG_EFFECT_REPLACE);
header('Content-Type: image/jpg');
imagejpeg($image);
imageline
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imageline($image, 0, 0, 100, 100, imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imageloadfont
<?php
var_dump(imageloadfont('04b.gdf'));
imageopenpolygon
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imageopenpolygon($image, [0, 0, 20, 30, 40, 50], 3, imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imagepalettecopy
<?php
$foo = imagecreate(100, 100);
imagecolorallocate($foo, 255, 255, 255);
$red = imagecolorallocate($foo, 255, 0, 0);
$bar = imagecreate(100, 100);
imagepalettecopy($bar, $foo);
imagepalettetotruecolor
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
$red = imagecolorallocate($image, 255, 0, 0);
var_dump(imagepalettetotruecolor($image));
imagepng
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
header('Content-Type: image/png');
imagepng($image);
imagepng($image, __DIR__ . '/example.png');
imagepolygon
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagepolygon($image, [20, 30, 50, 10, 80, 30, 70, 85, 30, 85], 5, imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imagerectangle
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagerectangle($image, 20, 20, 80, 80, imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imageresolution
<?php
$image = imagecreate(100, 100);
var_dump(imageresolution($image));
imageresolution($image, 200);
var_dump(imageresolution($image));
imageresolution($image, 50, 100);
var_dump(imageresolution($image));
imagerotate
<?php
$image = imagecreatefromjpeg(__DIR__ . '/example.jpg');
$image = imagerotate($image, -90, 0);
header('Content-Type: image/jpg');
imagejpeg($image);
imagesavealpha
<?php
$image = imagecreatefrompng(__DIR__ . '/example.png');
var_dump(imagesavealpha($image, false));
var_dump(imagesavealpha($image, true));
imagescale
<?php
$image = imagecreatefromjpeg(__DIR__ . '/example.jpg');
$image = imagescale($image, 100, 100);
header('Content-Type: image/jpg');
imagejpeg($image);
imagesetbrush
<?php
$foo = imagecreate(100, 100);
$bar = imagecreatetruecolor(100, 100);
imagefill($bar, 0, 0, imagecolorallocate($bar, 255, 0, 0));
var_dump(imagesetbrush($foo, $bar));
imagesetclip
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagesetclip($image, 20, 20, 80, 80);
imageline($image, 0, 0, 100, 100, imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imagesetinterpolation
<?php
$image = imagecreate(100, 100);
var_dump(imagesetinterpolation($image, IMG_MITCHELL));
imagesetpixel
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagesetpixel($image, 10, 10, imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imagesetstyle
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
$red = imagecolorallocate($image, 255, 0, 0);
$green = imagecolorallocate($image, 0, 255, 0);
imagesetstyle($image, [$red, $red, $red, $green, $green, $green]);
imageline($image, 0, 0, 100, 100, IMG_COLOR_STYLED);
header('Content-Type: image/png');
imagepng($image);
imagesetthickness
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagesetthickness($image, 5);
imageline($image, 0, 0, 100, 100, imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imagesettile
<?php
$foo = imagecreate(100, 100);
$bar = imagecreate(100, 100);
var_dump(imagesettile($foo, $bar));
imagestring
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagestring($image, 5, 0, 0, 'foo', imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imagestringup
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagestringup($image, 5, 0, 100, 'foo', imagecolorallocate($image, 0, 0, 0));
header('Content-Type: image/png');
imagepng($image);
imagesx
<?php
var_dump(imagesx(imagecreate(100, 100)));
imagesy
<?php
var_dump(imagesy(imagecreate(100, 100)));
imagetruecolortopalette
<?php
$image = imagecreatetruecolor(100, 100);
imagefilledrectangle($image, 0, 0, 100, 100, imagecolorallocate($image, 255, 255, 255));
imagetruecolortopalette($image, false, 255);
header('Content-Type: image/png');
imagepng($image);
imagettfbbox
<?php
var_dump(imagettfbbox(20, 0, 'Arial.ttf', 'foo'));
imagettftext
<?php
$image = imagecreatetruecolor(100, 100);
imagefilledrectangle($image, 0, 0, 100, 100, imagecolorallocate($image, 255, 255, 255));
imagettftext($image, 20, 0, 20, 50, imagecolorallocate($image, 0, 0, 0), 'Arial.ttf', 'foo');
header('Content-Type: image/png');
imagepng($image);
imagetypes
<?php
var_dump(imagetypes());
imagewbmp
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagewbmp($image, __DIR__ . '/example.wbmp');
imagewebp
<?php
$image = imagecreatetruecolor(100, 100);
imagecolorallocate($image, 255, 255, 255);
header('Content-Type: image/webp');
imagewebp($image);
imagewebp($image, __DIR__ . '/example.webp');
imagexbm
<?php
$image = imagecreate(100, 100);
imagecolorallocate($image, 255, 255, 255);
imagexbm($image, __DIR__ . '/example.xbm');