Return responsiveUrls (srcset info) in ApiQueryImageInfo response
This is needed to ensure Parsoid can return accurate srcset information even in standalone mode, when it uses the action API to query the host wiki. Parsoid used to use the ParsoidBatchAPI extension to access this information, but that extension has been deprecated and removed from production. Bug: T226683 Change-Id: Id7bc4f5385a6caec6b2c0119511242fb381da471
This commit is contained in:
parent
2d0cf09cdf
commit
545f691f87
1 changed files with 8 additions and 0 deletions
|
|
@ -527,6 +527,14 @@ class ApiQueryImageInfo extends ApiQueryBase {
|
|||
$mto->getExtension(), $file->getMimeType(), $thumbParams );
|
||||
$vals['thumbmime'] = $mime;
|
||||
}
|
||||
// Report srcset parameters
|
||||
Linker::processResponsiveImages( $file, $mto, [
|
||||
'width' => $vals['thumbwidth'],
|
||||
'height' => $vals['thumbheight']
|
||||
] + $thumbParams );
|
||||
foreach ( $mto->responsiveUrls as $density => $url ) {
|
||||
$vals['responsiveUrls'][$density] = wfExpandUrl( $url, PROTO_CURRENT );
|
||||
}
|
||||
} elseif ( $mto && $mto->isError() ) {
|
||||
/** @var MediaTransformError $mto */
|
||||
'@phan-var MediaTransformError $mto';
|
||||
|
|
|
|||
Loading…
Reference in a new issue