File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed
Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change 33namespace Embed \ImageInfo ;
44
55use GuzzleHttp \Pool ;
6+ use GuzzleHttp \Exception \RequestException ;
67
78/**
89 * Class to retrieve the size and mimetype of images using Guzzle5.
910 */
1011class Guzzle5 implements ImageInfoInterface
1112{
13+ use UtilsTrait;
14+
1215 /**
1316 * {@inheritdoc}
1417 */
@@ -23,6 +26,13 @@ public static function getImagesInfo(array $urls, array $config = null)
2326 // Build parallel requests
2427 $ requests = [];
2528 foreach ($ urls as $ url ) {
29+ if (strpos ($ url ['value ' ], 'data: ' ) === 0 ) {
30+ if ($ info = static ::getEmbeddedImageInfo ($ url ['value ' ])) {
31+ $ result [] = array_merge ($ url , $ info );
32+ }
33+ continue ;
34+ }
35+
2636 $ requests [] = $ client ->createRequest ('GET ' , $ url ['value ' ]);
2737 }
2838
@@ -32,6 +42,10 @@ public static function getImagesInfo(array $urls, array $config = null)
3242 // Build result set
3343 $ result = [];
3444 foreach ($ responses as $ i => $ response ) {
45+ if ($ response instanceof RequestException) {
46+ continue ;
47+ }
48+
3549 if (($ size = @getimagesizefromstring ($ response ->getBody ())) !== false ) {
3650 $ result [] = [
3751 'width ' => $ size [0 ],
You can’t perform that action at this time.
0 commit comments