File tree Expand file tree Collapse file tree 1 file changed +2
-20
lines changed
Expand file tree Collapse file tree 1 file changed +2
-20
lines changed Original file line number Diff line number Diff line change @@ -159,14 +159,6 @@ public function dispatchImages(array $urls)
159159 return [];
160160 }
161161
162- $ finfo = finfo_open (FILEINFO_MIME_TYPE );
163- $ mimetypes = [
164- 'image/jpeg ' ,
165- 'image/png ' ,
166- 'image/gif ' ,
167- 'image/bmp ' ,
168- 'image/x-icon ' ,
169- ];
170162 $ curl_multi = curl_multi_init ();
171163 $ responses = [];
172164 $ connections = [];
@@ -189,20 +181,11 @@ public function dispatchImages(array $urls)
189181
190182 $ curl = new CurlResult ($ connection );
191183
192- $ curl ->onBody (function ($ body , stdClass $ data ) use ($ finfo , $ mimetypes ) {
193- if (empty ($ data ->mime )) {
194- $ data ->mime = finfo_buffer ($ finfo , $ body );
195-
196- if (!in_array ($ data ->mime , $ mimetypes , true )) {
197- $ data ->mime = null ;
198-
199- return false ;
200- }
201- }
202-
184+ $ curl ->onBody (function ($ body , stdClass $ data ) {
203185 if (($ info = getimagesizefromstring ($ body ))) {
204186 $ data ->width = $ info [0 ];
205187 $ data ->height = $ info [1 ];
188+ $ data ->mime = $ info ['mime ' ];
206189
207190 return false ;
208191 }
@@ -246,7 +229,6 @@ public function dispatchImages(array $urls)
246229 }
247230 }
248231
249- finfo_close ($ finfo );
250232 curl_multi_close ($ curl_multi );
251233
252234 ksort ($ responses , SORT_NUMERIC );
You can’t perform that action at this time.
0 commit comments