Skip to content

Commit

Permalink
Merge da930ef into d36a7bc
Browse files Browse the repository at this point in the history
  • Loading branch information
jgullstr committed Aug 13, 2018
2 parents d36a7bc + da930ef commit 92f0b32
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/ImageResize.php
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ public function __construct($filename)
if (!defined('IMAGETYPE_WEBP')) {
define('IMAGETYPE_WEBP', 18);
}
if ($filename === null || empty($filename) || (substr($filename, 0, 7) !== 'data://' && !is_file($filename))) {
if ($filename === null || empty($filename) || (substr($filename, 0, 5) !== 'data:' && !is_file($filename))) {
throw new ImageResizeException('File does not exist');
}

Expand Down
9 changes: 9 additions & 0 deletions test/ImageResizeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ class ImageResizeTest extends TestCase

private $unsupported_image = 'Qk08AAAAAAAAADYAAAAoAAAAAQAAAAEAAAABABAAAAAAAAYAAAASCwAAEgsAAAAAAAAAAAAA/38AAAAA';
private $image_string = 'R0lGODlhAQABAIAAAAQCBP///yH5BAEAAAEALAAAAAABAAEAAAICRAEAOw==';
private $data_url = 'data:image/gif;base64,R0lGODlhAQABAIAAAAQCBP///yH5BAEAAAEALAAAAAABAAEAAAICRAEAOw==';


/**
Expand Down Expand Up @@ -65,6 +66,14 @@ public function testLoadString()
$this->assertInstanceOf('\Gumlet\ImageResize', $resize);
}

public function testLoadRfc2397()
{
$resize = new ImageResize($this->data_url);

$this->assertEquals(IMAGETYPE_GIF, $resize->source_type);
$this->assertInstanceOf('\Gumlet\ImageResize', $resize);
}

public function testAddFilter()
{
$image = $this->createImage(1, 1, 'png');
Expand Down

0 comments on commit 92f0b32

Please sign in to comment.