Topic on Project:Support desk

[RESOLVED] Error creating thumbnail

Summary by Ciencia Al Poder

If small images are thumnailed correctly but bigger ones fail, increase $wgMaxShellMemory

For example: $wgMaxShellMemory = 524288;

Cyberherbalist (talkcontribs)

I am getting the error message in the subject whenever I upload some image files (the only kind I have tried to upload so far). At the end of the upload, instead of seeing a thumbnail of the image, I get the message, "Error creating thumbnail". It almost seems like the size of the images might be the factor, but I don't know if this is true or not. For example, I uploaded a file of size 466 × 696 pixels, file size: 46 KB, and got the error. But when I uploaded a smaller version of it, 200 × 299 pixels, file size: 41 KB, the error didn't occur. The difference in file size seems negligible, although the pixel dimensions are more so.

I tried to upload successively larger pixel-size versions of the image, and did not get "Error creating thumbnail" until I tried 450x672. The next smaller size that didn't toss the error was 400x597. Incidentally, the file size on the 400x597 version was 100KB, twice as large as the original image that tossed the error.

I am using:

  • MediaWiki 1.19.2
  • PHP 5.3.27 (cgi-fcgi)
  • MySQL 5.1.56-log

My wiki can be found HERE, and a specific example of the problem is HERE.

Ciencia Al Poder (talkcontribs)

This may be a problem with the program used to generate those thumbnails (Imagemagick?), probably caused by insufficient available memory, or memory limitation for such process. Look at Manual:$wgMaxShellMemory for increasing it.

To see the exact error message that prevented the thumbnail to be generated, look at Manual:How to debug

Bawolff (talkcontribs)

I think your thumbnailing is broken. The reason why some images work, is that they are already so small that mediawiki doesn't try to downsize them. In this case I think its most likely an issue with missing image magick (aka the convert command), or mediawiki not having permission to run the command, etc. If you could post the debug log (See Ciencia's link Manual:How to debug) that would help identifying the problem. In this particular case, I don't think its $wgMaxShellMemory, since usually (not always) that has a non-empty error message.

If you absolutely cannot fix it, you can use $wgUseImageResize = false; which will prevent all scaling (but makes users download biggger image files).

Cyberherbalist (talkcontribs)

I did as suggested and modified the LocalSettings.php to add the logging item, exactly as spelled out. However, no logging information has shown up in the target folder. Seems unusual.

And I thought I would look at what the LocalSettings.php said about ImageMagick, and I found this:

$wgEnableUploads = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";

That path to the convert command is interesting, because there is no such path. No "usr" folder. Might this be the problem? ImageMagick is supposed to be installed in that folder?

Ciencia Al Poder (talkcontribs)

If there's no debug log, it may be that the server doesn't have permissions to write on the folder where the debug log would be created. Check those permissions, or point the debug log somewhere in the /tmp directory.

You may be on a shared host, in this situation you normally don't have access to all the filesystem, and instead you're chrooted on your own folder. If imagemagick is installed and the convert program accessible from your account, it may be on the $PATH, so maybe specifying just "convert" as the command may work.

Cyberherbalist (talkcontribs)

Yes, I am a on a shared host. Changing the path to ImageMagick to just "Convert" didn't fix it.

HOWEVER, I can now report that I found the solution! My wiki is on DreamHost, which has an automated MediaWiki installation process that I used to install. I thought that if they had some experience installing MW, then perhaps they might have run into this problem before, and might have a solution. I went to the support page of my web panel, and found that the DreamHost wiki is MediaWiki. I did a quick scan through their MediaWiki page and found the problem and the likely solution -- I applied it, and it worked! See for this particular issue.

In particular they suggested adding the line $wgMaxShellMemory = 524288; to the LocalSettings.php. Which is what, you, Ciencia, suggested originally.

I thank both Ciencia and Bawolff for working with me on this.

Soumya.sadanandan (talkcontribs)


$wgMaxShellMemory = 524288;


worked for me as well