Topic on Extension talk:Popups

Not getting images in Popups

11
Summary by Thiemo Kreuz (WMDE)

Images don't appear in popups if smaller than 320×250px.

Leonardo Rocca (talkcontribs)

The Popups extension works perfectly except it won't show the selected image by the PageImages extension.

Thiemo Kreuz (WMDE) (talkcontribs)

Are you talking about your own wiki, a 3rd-party installation, or a Wikimedia wiki? If so, which one?

Leonardo Rocca (talkcontribs)

I'm talking about my own MediaWiki wiki.

Thiemo Kreuz (WMDE) (talkcontribs)

I'm not sure what I can do for you then, or what your question is? Do you expect it to work in namespaces other than the main namespace? Do you get PageImages when you do example API queries like this?

Leonardo Rocca (talkcontribs)

1

My question is whether this is a know problem, I'm doing something wrong or I should report it as bug.

2

I'm expecting it to work in the main namespace. At least that's what I'm talking about.

3

Yes, I'm getting:

{
   "batchcomplete": "",
    "query": {
        "pages": {
            "18": {
                "pageid": 18,
                "ns": 0,
                "title": "File",
                "thumbnail": {
                    "source": "https://notmytrue.url/images/thumb/7/73/file.gif/50px-file.gif",
                    "width": 50,
                    "height": 23
                },
                "pageimage": "File.gif"
            }
        }
    }
}

which I assume it's proof the PageImages extension is working.

Thiemo Kreuz (WMDE) (talkcontribs)

Can you open the JavaScript console in your browser, go to the Network tab, hover a link on your page, and check if a request to your wikis api.php appears? The request should contain something like prop=info|extracts|pageimages|…, and the response something like in the example above.

Leonardo Rocca (talkcontribs)

The request appears:

{

   "batchcomplete": true,
   "query": {
       "pages": [
           {
               "pageid": 18,
               "ns": 0,
               "title": "Foo",
               "contentmodel": "wikitext",
               "pagelanguage": "it",
               "pagelanguagehtmlcode": "it",
               "pagelanguagedir": "ltr",
               "touched": "2020-03-19T22:35:41Z",
               "lastrevid": 165,
               "length": 1412,
               "fullurl": "https://notmytrue.url/wiki/Foo",
               "editurl": "https://notmytrue.url/index.php?title=Foo&action=edit",
               "canonicalurl": "https://notmytrue.url/wiki/Foo",
               "extract": "Foo...",
               "thumbnail": {
                   "source": "https://notmytrue.url/images/7/73/Foo.gif",
                   "width": 163,
                   "height": 76
               },
               "revisions": [
                   {
                       "timestamp": "2020-03-19T22:35:41Z"
                   }
               ]
           }
       ]
   }

}

but the image still doesn't appear. It it linked somehow to the RelatedPages extension? I can see that the image requested is already loaded...

I have seen that in another page where the image doesn't get loaded before the Popup shows the image. But I don't know if the two are related.

I will try to replicate the situation I have on the other page. Do you have other guesses about what the cause may be?

Thiemo Kreuz (WMDE) (talkcontribs)

The code that creates a popup uses the thumbnail element from this response, and doesn't do much on top of that, as far as I'm aware of. I'm afraid I'm unable to give you more support for a 3rd-party installation I don't have access to. Especially since your last comment sounds like you do get images in some popups. If this is true, how can it be a problem with the Popups extension then?

Kam193 (talkcontribs)

I'd like to refresh the thread. On my wiki, the extension show the image for some pages, for other not - very similar situation:

  1. I'm talking about pages that have the thumbnail property with an image in the response.
  2. If the image is not shown, there is no request for it.
  3. I make some debugging and see that there is no place for image in generated code if the problem occurs.
  4. The only difference I see at the moment is the size of the returned thumbnail. I see that probably bigger images are shown, but a bit smaller not. E.g. 256x320 - correct, 203x249 - not.

I see there is some logic related to the image size, but I'm not able to debug the JS code. Maybe there is some small mistake in processing image size?

Thiemo Kreuz (WMDE) (talkcontribs)

This sounds a bit like the issue described in phab:T268999. Short version is: The image must be at least 320px wide or 250px tall. Otherwise it can't be shown.

Kam193 (talkcontribs)

Exactly, it looks like the source of the evil. Would be great to at least document this requirement on the extension page. Although I don't understand this requirement (I think we can allow a bit smaller images to be shown), it's now clear for me, and I'm not looking to find what I configured wrong :)