Page MenuHomePhabricator

Thumbnails don't work
Closed, DeclinedPublic

Description

Author: bdaszyns

Description:
None of the following lines display any image on my wiki page. I've uploaded the image and can see
it full size by saying [[Image:100_0170.JPG]]. But when using the "thumb" option, it will only
display the image if the px number is at least as large as the original image. Otherwise it
doesn't show up and just displays a red X. Is there anything I'm doing wrong? Is this a bug?

[[Image:100_0170.JPG|thumb|none|191px|left|Sample thumbnail]]

[[Image:100_0170.JPG|191px|]]


Version: 1.10.x
Severity: major
OS: Linux
Platform: PC

Details

Reference
bz2848

Event Timeline

bzimport raised the priority of this task from to High.Nov 21 2014, 8:41 PM
bzimport set Reference to bz2848.
bzimport added a subscriber: Unknown Object (MLST).

You want to enable image resizing in LocalSettings.php
$wgUseImageResize = true;

That should use GD for resizing. Eventually install imagemagick and add:
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";

bdaszyns wrote:

(In reply to comment #1)

You want to enable image resizing in LocalSettings.php
$wgUseImageResize = true;
That should use GD for resizing. Eventually install imagemagick and add:
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";

Hey Ashar. I installed ImageMagick and changed the approproate lines in LocalSettings.php to enable it. But
still have the same result.

I can see that the images are not being generated in the "images" subfolders. As a result I see the following errors in the
error log:

[Thu Jul 14 09:18:59 2005] [error] [client 132.224.125.91] File does not exist: C:/Program
Files/TSW/Apache2/htdocs/mediawiki/images/thumb/a/ad/100_0170.JPG/191px-100_0170.JPG, referer:
http://132.228.122.89/mediawiki/index.php/Brad%27s_Playground

My LocalSettings.php looks like this:

$wgEnableUploads = true;
$wgUseImageResize = true;
$wgUseImageMagick = true;

$wgImageMagickConvertCommand = "C:\\Program Files\\imagemagick-6.2.3-q16\\convert.exe";

konrad.pfleiderer wrote:

I' ve modified the file includes/media/Bitmap.php. Now the thumbnailing works fine. Especially redirect from stderr output to stdoutput at the end of the command makes the command not working. The command tries to create a file "2>&1". Also the function wfEscapeShellArg() which escapes the $wgImageMagickConvertCommand, $srcPath and $dstPath makes the command not working.

Below i've my solution for the problem.

/*modified by kpf 16.01.2008*/

$cmd  =  $wgImageMagickConvertCommand .
        " {$quality} -background white -size {$physicalWidth} ".
        $srcPath .
        // Coalesce is needed to scale animated GIFs properly (bug 1017).
        ' -coalesce ' .
        // For the -resize option a "!" is needed to force exact size,
        // or ImageMagick may decide your ratio is wrong and slice off
        // a pixel.
        " -thumbnail " . wfEscapeShellArg( "{$physicalWidth}x{$physicalHeight}!" ) .
        " -depth 8 $sharpen " .
        $dstPath;

/*

$cmd  =  wfEscapeShellArg($wgImageMagickConvertCommand) .
        " {$quality} -background white -size {$physicalWidth} ".
        wfEscapeShellArg($srcPath) .
        // Coalesce is needed to scale animated GIFs properly (bug 1017).
        ' -coalesce ' .
        // For the -resize option a "!" is needed to force exact size,
        // or ImageMagick may decide your ratio is wrong and slice off
        // a pixel.
        " -thumbnail " . wfEscapeShellArg( "{$physicalWidth}x{$physicalHeight}!" ) .
        " -depth 8 $sharpen " .
        wfEscapeShellArg($dstPath)  " 2>&1";

/*end modified*/

Gilles raised the priority of this task from High to Unbreak Now!.Dec 4 2014, 10:21 AM
Gilles moved this task from Untriaged to Done on the Multimedia board.
Gilles lowered the priority of this task from Unbreak Now! to High.Dec 4 2014, 11:23 AM