File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Expand file tree Collapse file tree 2 files changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -105,7 +105,7 @@ public function __construct($filename)
105105 if (!defined ('IMAGETYPE_WEBP ' )) {
106106 define ('IMAGETYPE_WEBP ' , 18 );
107107 }
108- if ($ filename === null || empty ($ filename ) || (substr ($ filename , 0 , 7 ) !== 'data:// ' && !is_file ($ filename ))) {
108+ if ($ filename === null || empty ($ filename ) || (substr ($ filename , 0 , 5 ) !== 'data: ' && !is_file ($ filename ))) {
109109 throw new ImageResizeException ('File does not exist ' );
110110 }
111111
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ class ImageResizeTest extends TestCase
1515
1616 private $ unsupported_image = 'Qk08AAAAAAAAADYAAAAoAAAAAQAAAAEAAAABABAAAAAAAAYAAAASCwAAEgsAAAAAAAAAAAAA/38AAAAA ' ;
1717 private $ image_string = 'R0lGODlhAQABAIAAAAQCBP///yH5BAEAAAEALAAAAAABAAEAAAICRAEAOw== ' ;
18+ private $ data_url = 'data:image/gif;base64,R0lGODlhAQABAIAAAAQCBP///yH5BAEAAAEALAAAAAABAAEAAAICRAEAOw== ' ;
1819
1920
2021 /**
@@ -65,6 +66,14 @@ public function testLoadString()
6566 $ this ->assertInstanceOf ('\Gumlet\ImageResize ' , $ resize );
6667 }
6768
69+ public function testLoadRfc2397 ()
70+ {
71+ $ resize = new ImageResize ($ this ->data_url );
72+
73+ $ this ->assertEquals (IMAGETYPE_GIF , $ resize ->source_type );
74+ $ this ->assertInstanceOf ('\Gumlet\ImageResize ' , $ resize );
75+ }
76+
6877 public function testAddFilter ()
6978 {
7079 $ image = $ this ->createImage (1 , 1 , 'png ' );
You can’t perform that action at this time.
0 commit comments