Jesus · Bible · HTML · CSS · JS · PHP · SVG · Applications

imageistruecolor

Description

The imageistruecolor of Image for PHP finds whether an image is a truecolor image.

Syntax

imageistruecolor(
    GdImage $image
): bool

Parameters

image

A GdImage object, returned by one of the image creation functions, such as imagecreatetruecolor().

Return

Returns true if the image is truecolor, false otherwise.

Examples

1 · imagecreate

<?

$width = 100;
$height = 100;
$image = imagecreate($width, $height);

$return = imageistruecolor($image);

var_export($return);

?>
false

2 · imagecreatetruecolor

<?

$width = 100;
$height = 100;
$image = imagecreatetruecolor($width, $height);

$return = imageistruecolor($image);

var_export($return);

?>
true

3 · imagecreatefromgif

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/gif/1.gif';
$image = imagecreatefromgif($filename);

$return = imageistruecolor($image);

var_export($return);

?>
false

4 · imagecreatefromjpeg

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/jpg/1.jpg';
$image = imagecreatefromjpeg($filename);

$return = imageistruecolor($image);

var_export($return);

?>
true

5 · imagecreatefrompng

<?

$filename = $_SERVER['DOCUMENT_ROOT'] . '/assets/png/1.png';
$image = imagecreatefrompng($filename);

$return = imageistruecolor($image);

var_export($return);

?>
true
HomeMenu