
- PHP 7 Tutorial
- PHP 7 - Home
- PHP 7 - Introduction
- PHP 7 - Performance
- PHP 7 - Environment Setup
- PHP 7 - Scalar Type Declarations
- PHP 7 - Return Type Declarations
- PHP 7 - Null Coalescing Operator
- PHP 7 - Spaceship Operator
- PHP 7 - Constant Arrays
- PHP 7 - Anonymous Classes
- PHP 7 - Closure::call()
- PHP 7 - Filtered unserialize()
- PHP 7 - IntlChar
- PHP 7 - CSPRNG
- PHP 7 - Expectations
- PHP 7 - use Statement
- PHP 7 - Error Handling
- PHP 7 - Integer Division
- PHP 7 - Session Options
- PHP 7 - Deprecated Features
- PHP 7 - Removed Extensions & SAPIs
- PHP 7 Useful Resources
- PHP 7 - Quick Guide
- PHP 7 - Useful Resources
- PHP 7 - Discussion
How to enable or disable interlace using imageinterlace() function in PHP?
imageinterlace() is an inbuilt PHP function that is used to enable or disable interlace in an image. It is a method of encoding a bitmap image such that a person who has partially received it sees a degraded copy of the entire image.
Interlacing an image lets users see portions of it as it loads, and it takes different forms depending on the image type. The non-interlaced JPEGs appear line-by-line. To enable interlacing on picture, we can simply call this function with the second parameter set to 1, or set to 0 (zero) to disable it.
Syntax
int imageinterlace(resource $image, int $interlace)
Parameters
imageinterlace() takes two parameters: $image and $interlace.
$image − Specifies the image to be interlaced.
$interlace − Specifies whether to enable or disable interlacing.
Return Values
imageinterlace() returns 1 if the interlace bit is set for the image, else it returns 0.
Example 1
<?php //load an image by using imagecreatefromjpeg() function $img = imagecreatefromjpeg('C:\xampp\htdocs\test\30.jpg'); // Enable interlacing by using one imageinterlace($img, 1); // View the output image header('Content-type: image/jpeg'); imagejpeg($img); imagedestroy($img); ?>
Example 2
In this example, we have disabled interlacing.
<?php //load an image by using imagecreatefromjpeg() function $img = imagecreatefromjpeg('C:\xampp\htdocs\test\30.jpg'); // Disable interlacing by using zero imageinterlace($img, 0); // View the output image header('Content-type: image/jpeg'); imagejpeg($img); imagedestroy($img); ?>
Output
- Related Articles
- How to enable or disable local user on Windows OS using PowerShell?
- How to enable or disable the GPS programmatically on Kotlin?
- How to enable and disable submit button using jQuery?
- How to enable / Disable Enhanced Protection Mode in Internet Explorer using PowerShell?
- How to Disable / Enable a Button in TKinter?
- How to disable/ enable checkbox with jQuery?
- How to enable/disable data connection in iOS programmatically?
- How to enable/disable the GPS programmatically in Android?
- How to disable/enable an input box with jQuery?
- Enable and disable interrupts in Arduino
- How to disable copy content function using jQuery?
- How To enable GZIP Compression in PHP?
- How can I disable/enable GPS programmatically in android?
- How can we ENABLE AND DISABLE a particular MySQL event?
- How to get or set the resolution of an image using imageresolution() function in PHP?
