Skip to content

Commit

Permalink
Merge pull request #495 from wikimedia/cover-thumb-width
Browse files Browse the repository at this point in the history
Add iiurlwidth API param when fetching cover image info
  • Loading branch information
samwilson authored Dec 24, 2023
2 parents 09aff85 + 5c54f40 commit e091fdb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/BookProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,8 @@ public function getCover( $cover ): ?Picture {
}
$iinfo = $page['imageinfo'][0];

$thumbParams = min( $iinfo['width'], 400 ) . 'px';
$thumbWidth = min( $iinfo['width'], 400 );
$thumbParams = $thumbWidth . 'px';

// sanitize the page number if there is one
if ( in_array( $iinfo['mime'], [ 'image/vnd.djvu', 'application/pdf' ] ) ) {
Expand All @@ -310,7 +311,8 @@ public function getCover( $cover ): ?Picture {
'titles' => 'File:' . $title,
'prop' => 'imageinfo',
'iiprop' => 'thumbmime|url|canonicaltitle',
'iiurlparam' => $thumbParams
'iiurlparam' => $thumbParams,
'iiurlwidth' => $thumbWidth,
] )->wait();

$page = end( $response['query']['pages'] );
Expand Down

0 comments on commit e091fdb

Please # to comment.