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)
159
159
return [];
160
160
}
161
161
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
- ];
170
162
$ curl_multi = curl_multi_init ();
171
163
$ responses = [];
172
164
$ connections = [];
@@ -189,20 +181,11 @@ public function dispatchImages(array $urls)
189
181
190
182
$ curl = new CurlResult ($ connection );
191
183
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 ) {
203
185
if (($ info = getimagesizefromstring ($ body ))) {
204
186
$ data ->width = $ info [0 ];
205
187
$ data ->height = $ info [1 ];
188
+ $ data ->mime = $ info ['mime ' ];
206
189
207
190
return false ;
208
191
}
@@ -246,7 +229,6 @@ public function dispatchImages(array $urls)
246
229
}
247
230
}
248
231
249
- finfo_close ($ finfo );
250
232
curl_multi_close ($ curl_multi );
251
233
252
234
ksort ($ responses , SORT_NUMERIC );
You can’t perform that action at this time.
0 commit comments