Topic on Project:Support desk

MediaWiki not creating thumbnails for JPEG images

Summary by NutchapolSal


  • Did not enabled exif extension in php
  • Uploaded a JPEG
  • It now shows as blank placeholder, Embedding doesn't work with that file


  • Enable exif
  • Either delete & reupload files or manually fix values in the database Run refreshImageMetadata.php
NutchapolSal (talkcontribs)

For some reason, My MediaWiki install isn't creating thumbnails for jpegs. I've tried uploading 2 jpeg images and the File: pages show a blank placeholder image, reporting 0 x 0 as dimensions, and having an _error -1 metadata while able to show the file size. The files got uploaded correctly as they're there in images/x/xx/. Both images aren't big, they're around 1280x720.

I've tried uploading a png image, however it does work fine.

I then tried debug logging while reloading the File: pages, hoping to see some ImageMagick command failures as I'm using ImageMagick 7 and there's no mention of using "magick.exe" instead of "convert.exe" in any MediaWiki manual so far, however it turns out that I can't find any trace of thumbnails in the File: jpeg pages (tried searching for "thumbnail", "TransformationalImageHandler", etc. only found in the png page). No empty folders in thumbs either, it looks just like the whole thumbnailing part got skipped.

So I guess my question is how do I turn on/fix JPEG thumbnailing?

Installed Software:

Product Version
MediaWiki 1.38.1
PHP 8.1.7 (cgi-fcgi)
MariaDB 10.6.8-MariaDB
ICU 70.1
Lua 5.1.5
Pygments 2.11.2

Some screenshots from the File: pages

PS. tried uploading a small 10 x 10 jpeg, thumbnail still fails so it's definitely not some filesize/dimension limiter

Bawolff (talkcontribs)

There is a bug in mediawiki 1.38 where jpeg are broken if you have php's exif extension disabled (should be fixed next release of mediawiki). Try enabling it in your php.ini file and see if that helps.

Alternatively, try setting $wgShowEXIF=false;

NutchapolSal (talkcontribs)

Setting $wgShowEXIF = false; only removed the _error -1 metadata, and enabling exif didn't do anything (still shows the same blank placeholder)

I'm running on Windows Server 2012 R2 (with Media Foundation enabled and updates installed), could that have something to do with the issue?

Bawolff (talkcontribs)

After enabling exif, were newly uploaded still broken, or was it jusf preexisting files?

NutchapolSal (talkcontribs)

Oh, only just preexisting files.

I think it might not just be thumbnails, as they doesn't embed when doing [[File:badfile.jpg]], but shows a link to the File: page

NutchapolSal (talkcontribs)

Tried running rebuildImages.php, didn't fixed it. Tried just uploading a new version incase getting the file through "new file processing" again might help, rejected for being the exact same file. I guess the only way to "solve" this is to delete + clear deleted files then uploading as a new file. (if that still doesn't work, Bruh)

NutchapolSal (talkcontribs)

Looked in the database, I'm guessing the broken fields affecting image things are img_width, img_height, img_bits, in image table. Filling in these ones manually fixes the problem completely (i dont think that's a good idea). img_metadata isn't technically broken anyways, only filled with placeholder. Pages with those images embedded but still not showing up can probably be fixed with a page purge.

Bawolff (talkcontribs)

Try refreshImageMetadata.php --force

NutchapolSal (talkcontribs)

Ok that script actually fixed everything