Topic on Project:Support desk

Can't get image thumbnailing to work / ImageMagick 7

12
Summary by MarkAHershberger

A friend noticed that Apache was running as a 32-bit process. The ImageMagick I had installed was 64-bit, so couldn't access it.

Frecklefoot (talkcontribs)

We installed MediaWiki here at work (and it's awesome). Images and image uploading work fine, but we can't get image thumbnailing to work. I've installed ImageMagick 7 on the host machine (Windows) and I think I've made all of the correct changes to LocalSettings.php, but whenever we try thumbnailing, Apache crashes. No messages are logged in the error log until it restarts. I know ImageMagick 7 uses magick instead of convert, so I have that change.

Here are the pertinent entries from the PHP file:

$wgSVGConverterPath = ;
$wgUseImageMagick = true;
$wgUseImageResize = true;
$wgTmpDirectory = true;
$wgImageMagickConvertCommand = 'C:/Program Files/ImageMagick-7.0.3-Q16/magick.exe';

I don't actually have a "Tmp" directory defined, but I couldn't find a setting that sets that.

Any idea of what I can check?

83.135.227.123 (talkcontribs)

When I last installed IM under Windows, it also had a convert.exe coming with it. I don't know for certain, but it might be that both, magick.exe and convert.exe just are identical.

Note that your value for $wgTmpDirectory is invalid! It has to be a valid path!

What the line $wgSVGConverterPath = ; does is not clear to me. Defining a variable with an equal sign, but then putting nothing at all behind it looks close to a syntax error. I would just leave this line away.

Frecklefoot (talkcontribs)

Sorry about the $wgSVGConverterPath confusion. I guess it got wikified out. What it's supposed to look like is:

$wgSVGConverterPath = '';

Thanks for the suggestion. I'll try changing $wgTmpDirectory to a path.

Frecklefoot (talkcontribs)

Okay, I changed $wgTmpDirectory to a valid path, but it still doesn't work. Thanks for pointing it out, though!

MarkAHershberger (talkcontribs)

magick.exe is the wrong executable. There should be a convert.exe file.

Frecklefoot (talkcontribs)

"Convert" was deprecated for ImageMagick 7. The new name of the conversion executable is Magick.exe. There is no convert.exe.

83.135.237.233 (talkcontribs)

Actually, in the latest version, there are no less than nine (9) executables, which all have the same size: magick.exe is one of them, but there also are identify, composite, compare and convert.exe.

The difference between magick.exe and convert.exe is 2 bytes out of around 16MB.

Frecklefoot (talkcontribs)

I installed ImageMagick-7.0.3-Q16 and I see six executables and one of them is the uninstaller:

  • dcraw
  • ffmpeg
  • hp2xx
  • imdisplay
  • magick
  • unins000

I was confused that I didn't see convert anywhere, but somewhere I saw that it was changed to magick and convert was gone. It was actually about another user trying to get ImageMagick to work with MediaWiki. I see that the latest version of ImageMagick is now 7.0.4.0. I'll uninstall 7.0.3 and install the new version and see what I get.

Frecklefoot (talkcontribs)

Okay, installed 7.0.4.0 and saw in the install Wizard that you can choose to "Install legacy utilities (e.g. convert)". Selecting that gives me 14 executables, one of which is, indeed, convert. Apache still crashes when I try to display a thumbnail, however. And nothing is recorded in the error log except for the fact that it crashed and is restarting. I'm sure that just one of my settings is wrong, though. Here are my pertinent settings now:

# Image Converter
$wgSVGConverter = 'ImageMagick';

# Image converter path
$wgSVGConverterPath = '';

## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads  = true;
$wgUseImageMagick = true;
$wgUseImageResize = true;
$wgTmpDirectory   = 'D:/xampp/imagetemp';
$wgImageMagickConvertCommand = 'C:/Program Files/ImageMagick-7.0.4-Q16/convert.exe';

# Path to jpegtran utility
$wgJpegTran = 'D:/xampp/common/bin/';

# Path to tidy utility binary
$wgTidyBin = 'D:/xampp/common/bin/';

D:/xampp/common/bin/ doesn't exist, but I don't know if that is related or not. I don't know what the jpegtran utility or tidy utility are. D:/xampp/imagetemp does exist, and I set it was Read-only. I changed it so it was writable, but it keeps getting set back to Read-only.

83.135.237.233 (talkcontribs)

If jpegTran and Tidy are not installed in your system, you can just remove the two lines from your configuration. ImageMagick can also work without them.

It is important that the temp directory actually is working. Does it work, if you remove the line on $wgTmpDirectory so that you just leave $wgTmpDirectory unchanged? MediaWiki should find the right path automatically - at least in theory.

$wgImageMagickConvertCommand should be ok as you have it.

If the above changs alone are not yet solving the problem, then I would set up debugging like so:

$wgDebugLogFile = "D:/xampp/mediawiki-debug.log";
Frecklefoot (talkcontribs)

Thanks for your reply! I'll give those suggestions a shot when I get some time.

Frecklefoot (talkcontribs)

SOLVED. A friend noticed that Apache was running as a 32-bit process. The ImageMagick I had installed was 64-bit, so couldn't access it. I installed the 32-bit version of ImageMagick and PRESTO! Thanks for all your help! Turning on the logging was the first step in finding the solution. :)