Yuvipanda has uploaded a new change for review. https://gerrit.wikimedia.org/r/201613
Change subject: Add 'source' parameter to API for getting original url ...................................................................... Add 'source' parameter to API for getting original url Bug: T94928 Change-Id: I3bb8fb39385d8d6aec2504f121c684205ea82067 --- M ApiQueryPageImages.php 1 file changed, 7 insertions(+), 3 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/PageImages refs/changes/13/201613/1 diff --git a/ApiQueryPageImages.php b/ApiQueryPageImages.php index fd1fa76..214eddb 100644 --- a/ApiQueryPageImages.php +++ b/ApiQueryPageImages.php @@ -99,8 +99,8 @@ */ protected function setResultValues( $prop, $pageId, $fileName, $size ) { $vals = array(); + $file = wfFindFile( $fileName ); if ( isset( $prop['thumbnail'] ) ) { - $file = wfFindFile( $fileName ); if ( $file ) { $thumb = $file->transform( array( 'width' => $size, 'height' => $size ) ); if ( $thumb && $thumb->getUrl() ) { @@ -118,6 +118,9 @@ if ( isset( $prop['name'] ) ) { $vals['pageimage'] = $fileName; } + if ( isset( $prop['source'] ) ) { + $vals['source'] = wfExpandUrl( $file->getUrl(), PROTO_CURRENT); + } $this->getResult()->addValue( array( 'query', 'pages' ), $pageId, $vals ); } @@ -128,7 +131,7 @@ public function getAllowedParams() { return array( 'prop' => array( - ApiBase::PARAM_TYPE => array( 'thumbnail', 'name' ), + ApiBase::PARAM_TYPE => array( 'thumbnail', 'name', 'source' ), ApiBase::PARAM_ISMULTI => true, ApiBase::PARAM_DFLT => 'thumbnail|name', ), @@ -153,7 +156,8 @@ return array( 'prop' => array( 'What information to return', ' thumbnail - URL and dimensions of image associated with page, if any', - ' name - image title' + ' name - image title', + ' source - URL to the image original', ), 'thumbsize' => 'Maximum thumbnail dimension', 'limit' => 'Properties of how many pages to return', -- To view, visit https://gerrit.wikimedia.org/r/201613 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I3bb8fb39385d8d6aec2504f121c684205ea82067 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/extensions/PageImages Gerrit-Branch: master Gerrit-Owner: Yuvipanda <yuvipa...@gmail.com> _______________________________________________ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits