@@ -34,18 +34,20 @@ public function __construct(array $config = [])
3434 {
3535 $ this ->config = $ config + $ this ->config ;
3636
37- $ cookies = str_replace ('// ' , '/ ' , sys_get_temp_dir ().'/embed-cookies. ' .uniqid ());
37+ if (!isset ($ this ->config [CURLOPT_COOKIEJAR ])) {
38+ $ cookies = str_replace ('// ' , '/ ' , sys_get_temp_dir ().'/embed-cookies. ' .uniqid ());
3839
39- if (is_file ($ cookies )) {
40- if (!is_writable ($ cookies )) {
41- throw new EmbedException (sprintf ('The temporary cookies file "%s" is not writable ' , $ cookies ));
40+ if (is_file ($ cookies )) {
41+ if (!is_writable ($ cookies )) {
42+ throw new EmbedException (sprintf ('The temporary cookies file "%s" is not writable ' , $ cookies ));
43+ }
44+ } elseif (!is_writable (dirname ($ cookies ))) {
45+ throw new EmbedException (sprintf ('The temporary folder "%s" is not writable ' , dirname ($ cookies )));
4246 }
43- } elseif (!is_writable (dirname ($ cookies ))) {
44- throw new EmbedException (sprintf ('The temporary folder "%s" is not writable ' , dirname ($ cookies )));
45- }
4647
47- $ this ->config [CURLOPT_COOKIEJAR ] = $ cookies ;
48- $ this ->config [CURLOPT_COOKIEFILE ] = $ cookies ;
48+ $ this ->config [CURLOPT_COOKIEJAR ] = $ cookies ;
49+ $ this ->config [CURLOPT_COOKIEFILE ] = $ cookies ;
50+ }
4951 }
5052
5153 /**
@@ -103,7 +105,8 @@ public function dispatch(Url $url)
103105 $ result ['statusCode ' ],
104106 $ result ['contentType ' ],
105107 $ result ['content ' ],
106- $ result ['headers ' ]
108+ $ result ['headers ' ],
109+ $ result ['info ' ]
107110 );
108111 }
109112
@@ -196,7 +199,8 @@ public function dispatchImages(array $urls)
196199 $ result ['statusCode ' ],
197200 $ result ['contentType ' ],
198201 [$ result ['data ' ]->width , $ result ['data ' ]->height ],
199- $ result ['headers ' ]
202+ $ result ['headers ' ],
203+ $ result ['info ' ]
200204 );
201205 }
202206 }
0 commit comments