Skip to content

Commit 81c8385

Browse files
author
Mitch
committed
Basic image interlacing support
1 parent 6d2d6f8 commit 81c8385

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,18 @@ $result = $image->getImageAsString(IMAGETYPE_PNG, 4);
171171

172172
We're passing `null` for the image type in the example above to skip over it and provide the quality. In this case, the image type is assumed to be the same as the input.
173173

174+
Interlacing
175+
-----------
176+
177+
By default, [image interlacing](http://php.net/manual/en/function.imageinterlace.php) is turned off. It can be enabled by setting `$interlace` to `1`:
178+
179+
```php
180+
$image = new ImageResize('image.jpg');
181+
$image->scale(50);
182+
$image->interlace = 1;
183+
$image->save('image2.jpg')
184+
```
185+
174186
Chaining
175187
--------
176188

src/ImageResize.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ class ImageResize
1919
public $quality_jpg = 75;
2020
public $quality_png = 0;
2121

22+
public $interlace = 0;
23+
2224
public $source_type;
2325

2426
protected $source_image;
@@ -108,6 +110,8 @@ public function save($filename, $image_type = null, $quality = null, $permission
108110

109111
$dest_image = imagecreatetruecolor($this->getDestWidth(), $this->getDestHeight());
110112

113+
imageinterlace($dest_image, $this->interlace);
114+
111115
switch ($image_type) {
112116
case IMAGETYPE_GIF:
113117
$background = imagecolorallocatealpha($dest_image, 255, 255, 255, 1);

0 commit comments

Comments
 (0)