package org.wikipedia.page.gallery;

import org.json.JSONObject;
import org.mediawiki.api.json.Api;
import org.mediawiki.api.json.RequestBuilder;
import org.wikipedia.PageQueryTask;
import org.wikipedia.PageTitle;
import org.wikipedia.Site;

public class GalleryItemFetchTask extends PageQueryTask<GalleryItem> {
    public GalleryItemFetchTask(Api api, Site site, PageTitle title) {
        super(LOW_CONCURRENCY, api, site, title);
    }

    @Override
    public void buildQueryParams(RequestBuilder builder) {
        builder.param("prop", "imageinfo")
               .param("iiprop", "url|dimensions|mime|extmetadata")
               .param("iiurlwidth", "2048");
    }

    @Override
    public GalleryItem processPage(int pageId, PageTitle pageTitle, JSONObject pageData) throws Throwable {
        return new GalleryItem(pageData);
    }
}

package org.wikipedia.page.gallery;

import org.json.JSONObject;
import org.mediawiki.api.json.Api;
import org.mediawiki.api.json.RequestBuilder;
import org.wikipedia.PageQueryTask;
import org.wikipedia.PageTitle;
import org.wikipedia.Site;

public class GalleryItemFetchTask extends PageQueryTask<GalleryItem> {
    public GalleryItemFetchTask(Api api, Site site, PageTitle title) {
        super(LOW_CONCURRENCY, api, site, title);
    }

    @Override
    public void buildQueryParams(RequestBuilder builder) {
        builder.param("prop", "imageinfo")
               .param("iiprop", "url|dimensions|mime|extmetadata")
               .param("iiurlwidth", "2880");
    }

    @Override
    public GalleryItem processPage(int pageId, PageTitle pageTitle, JSONObject pageData) throws Throwable {
        return new GalleryItem(pageData);
    }
}

Adjust image size to fetch for gallery view.
Adjust image size to fetch for gallery view.

to comply with predefined bucket sizes, for performance/cache reasons:
https://git.wikimedia.org/blob/mediawiki%2Fextensions%2FMultimediaViewer.git/f9e7bae91a8032fa13fc68114a0d57d190ea77f9/resources%2Fmmv%2Fmmv.ThumbnailWidthCalculator.js

Change-Id: I6fef16c591d149e5e1c7a5e7ae53eb057bbef1c3
