File tree Expand file tree Collapse file tree 1 file changed +8
-6
lines changed
Expand file tree Collapse file tree 1 file changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -39,36 +39,38 @@ public static function getImagesInfo(array $urls, array $config = null)
3939
4040 // Build parallel requests
4141 $ requests = [];
42- foreach ($ urls as $ url ) {
42+ foreach ($ urls as $ k => $ url ) {
4343 if (strpos ($ url ['value ' ], 'data: ' ) === 0 ) {
4444 if ($ info = static ::getEmbeddedImageInfo ($ url ['value ' ])) {
45- $ result [] = array_merge ($ url , $ info );
45+ $ result [$ k ] = array_merge ($ url , $ info );
4646 }
4747 continue ;
4848 }
4949
50- $ requests [] = $ client ->createRequest ('GET ' , $ url ['value ' ]);
50+ $ requests [$ k ] = $ client ->createRequest ('GET ' , $ url ['value ' ]);
5151 }
5252
5353 // Execute in parallel
5454 $ responses = Pool::batch ($ client , $ requests );
5555
5656 // Build result set
57- foreach ($ responses as $ i => $ response ) {
57+ foreach ($ responses as $ k => $ response ) {
5858 if ($ response instanceof RequestException) {
5959 continue ;
6060 }
6161
6262 if (($ size = getimagesizefromstring ($ response ->getBody ())) !== false ) {
63- $ result [] = [
63+ $ result [$ k ] = [
6464 'width ' => $ size [0 ],
6565 'height ' => $ size [1 ],
6666 'size ' => $ size [0 ] * $ size [1 ],
6767 'mime ' => $ size ['mime ' ],
68- ] + $ urls [$ i ];
68+ ] + $ urls [$ k ];
6969 }
7070 }
7171
72+ ksort ($ result , SORT_NUMERIC );
73+
7274 return $ result ;
7375 }
7476}
You can’t perform that action at this time.
0 commit comments