<?php
int imageinterlace ( GdImage $image, ?bool $enable = null )
where,
$image = The image identifier
$enable = To control if interlace will be used or not
?>
IMAGE FORMAT | POSSIBLE LOADING ORDERS |
GIF | 0, 8, 16, ..., (8n+4) |
2, 6, 10, 14, ..., (4n+2) | |
1, 3, 5, 7, 9, ..., (2n+1) | |
PNG | Adam7 algorithm (Image from Wikipedia) |
JPEG | Does not make use of pixel interlacing, instead uses a sequence based on frequency decomposition. |
ed48 |
<?php
echo 'PHP VERSION: ' . PHP_VERSION . '<br><br>';
// $lang = 'pt';
$lang = 'en';
$org_file01 = "gif/GIF 024 01.gif";
$des_file01 = "gif/GIF 024 01 imageinterlace.gif";
$ctrl01 = 2;
echo $org_file01; ?><br><br>
<img src="<?php echo $org_file01; ?>"
alt="<?php echo $org_file01; ?>"
title="<?php echo $org_file01; ?>" width="400"><br><br>
<?php
$id_camel01 = imagecreatefromgif( $org_file01);
$interlaced01 = imageinterlace($id_camel01, $ctrl01);
if($interlaced01 == true)
{
imagegif($id_camel01, $des_file01);
$pt = 'IMAGEM ENTRELAÇADA';
$en = 'INTERLACED IMAGE';
echo $des_file01
. '<br>' . $$lang; ?><br><br>
<img src="<?php echo $des_file01; ?>"
alt="<?php echo $des_file01; ?>"
title="<?php echo $des_file01; ?>" width="400">
<?php
}
else
{
$pt = 'Imagem não pode ser entrelaçada!';
$en = 'Image can not be interlaced!';
echo $$lang;
}
?>
<?php
echo 'PHP VERSION: ' . PHP_VERSION . '<br><br>';
// $lang = 'pt';
$lang = 'en';
$org_file02 = "png/PNG 075 02.png";
$des_file02 = "png/PNG 075 02 imageinterlace.png";
$ctrl02 = 8;
echo $org_file02; ?><br><br>
<img src="<?php echo $org_file02; ?>"
alt="<?php echo $org_file02; ?>"
title="<?php echo $org_file02; ?>" width="400"><br><br>
<?php
$id_camel02 = imagecreatefrompng( $org_file02);
$interlaced02 = imageinterlace($id_camel02, $ctrl02);
if($interlaced02 == true)
{
imagepng($id_camel02, $des_file02);
$pt = 'IMAGEM ENTRELAÇADA';
$en = 'INTERLACED IMAGE';
echo $des_file02
. '<br>' . $$lang; ?><br><br>
<img src="<?php echo $des_file02; ?>"
alt="<?php echo $des_file02; ?>"
title="<?php echo $des_file02; ?>" width="400">
<?php
}
else
{
$pt = 'Imagem não pode ser entrelaçada!';
$en = 'Image can not be interlaced!';
echo $$lang;
}
?>
<?php
echo 'PHP VERSION: ' . PHP_VERSION . '<br><br>';
// $lang = 'pt';
$lang = 'en';
$org_file03 = "jpeg/JPEG 034 03.jpg";
$des_file03 = "jpeg/JPEG 034 03 imageinterlace.jpg";
$ctrl03 = 5;
echo $org_file03; ?><br><br>
<img src="<?php echo $org_file03; ?>"
alt="<?php echo $org_file03; ?>"
title="<?php echo $org_file03; ?>" width="400"><br><br>
<?php
$id_camel03 = imagecreatefromjpeg($org_file03);
$interlaced03 =
imageinterlace($id_camel03, $ctrl03);
if($interlaced03 == true)
{
imagejpeg($id_camel03, $des_file03);
$pt = 'IMAGEM ENTRELAÇADA';
$en = 'INTERLACED IMAGE';
echo $des_file03
. '<br>' . $$lang; ?><br><br>
<img src="<?php echo $des_file03; ?>"
alt="<?php echo $des_file03; ?>"
title="<?php echo $des_file03; ?>" width="400">
<?php
}
else
{
$pt = 'Imagem não pode ser entrelaçada!';
$en = 'Image can not be interlaced!';
echo $$lang;
}
?>