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)
105
105
if (!defined ('IMAGETYPE_WEBP ' )) {
106
106
define ('IMAGETYPE_WEBP ' , 18 );
107
107
}
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 ))) {
109
109
throw new ImageResizeException ('File does not exist ' );
110
110
}
111
111
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ class ImageResizeTest extends TestCase
15
15
16
16
private $ unsupported_image = 'Qk08AAAAAAAAADYAAAAoAAAAAQAAAAEAAAABABAAAAAAAAYAAAASCwAAEgsAAAAAAAAAAAAA/38AAAAA ' ;
17
17
private $ image_string = 'R0lGODlhAQABAIAAAAQCBP///yH5BAEAAAEALAAAAAABAAEAAAICRAEAOw== ' ;
18
+ private $ data_url = 'data:image/gif;base64,R0lGODlhAQABAIAAAAQCBP///yH5BAEAAAEALAAAAAABAAEAAAICRAEAOw== ' ;
18
19
19
20
20
21
/**
@@ -65,6 +66,14 @@ public function testLoadString()
65
66
$ this ->assertInstanceOf ('\Gumlet\ImageResize ' , $ resize );
66
67
}
67
68
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
+
68
77
public function testAddFilter ()
69
78
{
70
79
$ image = $ this ->createImage (1 , 1 , 'png ' );
You can’t perform that action at this time.
0 commit comments