mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-26 12:23:58 +01:00
MediaInterface.kt: fix MediaWiki API call to retrieve thumbnail URLs properly
Before this change, the API calls to MediaWiki would request thumbnails with atleast a specific width, rather than height. These thumbnails would often be extremely low resolution on very wide images, such as panoramas. This change instead requests thumbnails with atleast a specific height. Panorama thumbnails are now at a higher resolution than before. Additionally, the height parameter is now represented as an integer which can be changed more easily.
This commit is contained in:
parent
0ed9dac5d6
commit
09638b0c9b
1 changed files with 14 additions and 2 deletions
|
|
@ -186,13 +186,25 @@ interface MediaInterface {
|
|||
): Single<MwQueryResponse>
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* Retrieved thumbnail height will be about this tall, but must be at least this height.
|
||||
* A larger number means higher thumbnail resolution but more network usage.
|
||||
*/
|
||||
const val THUMB_HEIGHT_PX = 220
|
||||
|
||||
const val MEDIA_PARAMS =
|
||||
"&prop=imageinfo|coordinates&iiprop=url|extmetadata|user&&iiurlwidth=640&iiextmetadatafilter=DateTime|Categories|GPSLatitude|GPSLongitude|ImageDescription|DateTimeOriginal|Artist|LicenseShortName|LicenseUrl"
|
||||
"&prop=imageinfo|coordinates&iiprop=url|extmetadata|user&&iiurlheight=" +
|
||||
THUMB_HEIGHT_PX +
|
||||
"&iiextmetadatafilter=DateTime|Categories|GPSLatitude|GPSLongitude|" +
|
||||
"ImageDescription|DateTimeOriginal|Artist|LicenseShortName|LicenseUrl"
|
||||
|
||||
/**
|
||||
* fetches category detail(title, hidden) for each category along with File information
|
||||
*/
|
||||
const val MEDIA_PARAMS_WITH_CATEGORY_DETAILS =
|
||||
"&clprop=hidden&prop=categories|imageinfo&iiprop=url|extmetadata|user&&iiurlwidth=640&iiextmetadatafilter=DateTime|GPSLatitude|GPSLongitude|ImageDescription|DateTimeOriginal|Artist|LicenseShortName|LicenseUrl"
|
||||
"&clprop=hidden&prop=categories|imageinfo&iiprop=url|extmetadata|user&&iiurlheight=" +
|
||||
THUMB_HEIGHT_PX +
|
||||
"&iiextmetadatafilter=DateTime|GPSLatitude|GPSLongitude|ImageDescription|" +
|
||||
"DateTimeOriginal|Artist|LicenseShortName|LicenseUrl"
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue