Skip to content

Commit

Permalink
Merge pull request #23 from cainmi/feature_imageinterlace
Browse files Browse the repository at this point in the history
Basic image interlacing support
  • Loading branch information
adityapatadia committed Mar 24, 2015
2 parents 6d2d6f8 + 81c8385 commit bd99be7
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
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

0 comments on commit bd99be7

Please sign in to comment.