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

imageinterlace

Description

The imageinterlace of Image for PHP enable or disable interlace.

Syntax

imageinterlace(
    GdImage $image,
    ?bool $enable = null
): bool

Parameters

image

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

interlace

If true, the image will be interlaced, if false the interlace bit is turned off. Passing null will result in the interlacing behavior not being changed.

Return

Returns true if the interlace bit is set for the image, false otherwise.

Examples

1 · return

<?

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

$interlace = true;

$return = imageinterlace($image, $interlace);

var_export($return);

?>
true

2 · base64 · image

<?

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

imageinterlace($image);

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/gAIDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAANElEQVR4nO3BAQ0AAADCoPdPbQ43oAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfgx1lAABqFDyOQAAAABJRU5ErkJggg==">
</body>
</html>

3 · base64 · interlace · false

<?

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

$interlace = false;
imageinterlace($image, $interlace);

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/gAIDAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAANElEQVR4nO3BAQ0AAADCoPdPbQ43oAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAfgx1lAABqFDyOQAAAABJRU5ErkJggg==">
</body>
</html>

4 · base64 · interlace · true

<?

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

$interlace = true;
imageinterlace($image, $interlace);

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,iVBORw0KGgoAAAANSUhEUgAAAGQAAABkCAIAAAGIhzKVAAAACXBIWXMAAA7EAAAOxAGVKw4bAAAAMklEQVR4nO3BAQEAAACAkP6v7ggKAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAIABdewAAbiphDoAAAAASUVORK5CYII=">
</body>
</html>
HomeMenu