Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,18 @@ $result = $image->getImageAsString(IMAGETYPE_PNG, 4);

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.

Interlacing
-----------

By default, [image interlacing](http://php.net/manual/en/function.imageinterlace.php) is turned off. It can be enabled by setting `$interlace` to `1`:

```php
$image = new ImageResize('image.jpg');
$image->scale(50);
$image->interlace = 1;
$image->save('image2.jpg')
```

Chaining
--------

Expand Down
4 changes: 4 additions & 0 deletions src/ImageResize.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ class ImageResize
public $quality_jpg = 75;
public $quality_png = 0;

public $interlace = 0;

public $source_type;

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

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

imageinterlace($dest_image, $this->interlace);

switch ($image_type) {
case IMAGETYPE_GIF:
$background = imagecolorallocatealpha($dest_image, 255, 255, 255, 1);
Expand Down