Manual talk:Image administration

From mediawiki.org

See Error creating thumbnail for possible solutions for this error

Image Upload/Access location mismatch[edit]

  • In LocalSetting.php, I have set MW_INSTALL_PATH to /var/www/mediawiki
  • When I upload an image it goes into /var/www/mediawiki/images
  • But when I try to display that image, I get nothing. In the apache error log I see that it is trying to access the image file from /var/lib/mediawiki/images.


I installed from an ubuntu package, MediaWiki 1.11.2
How can I configure it for everything to come from /var/www/mediawiki?

Thanks

Update[edit]

-- I 'fixed' this by creating a symlink

How to use Mediawiki:Licenses?[edit]

I think the text in this article is hard to understand. I don't want my users to be able to upload images without selecting a license. How do I do that? There's a default option called "No license selected", I want that greyed out or something. Add: it would be nice to explain what to do or where to look if one (a 'sysop') wants to enable this. Currently, there's no clue where to go.

Cannot get convert (thumbnail) to work on W2k3[edit]

  • Installed Dynamic ImageMagick in the following directory -> D:\ImageMagick-6.3.0-Q16
  • Verified that ImageMagick worked on command line
  • Verified Environment variable is PATH'd correctly
  • Verified to Web Server has access to D:\ImageMagick-6.3.0-Q16 directory
  • Modified LocalSettings.php with the following lines:
$wgUseImageResize = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "D:\\ImageMagick-6.3.0-Q16\\convert.exe";

also tried:

$wgImageMagickConvertCommand = "D:\\ImageMagick-6.3.0-Q16\\convert";
$wgImageMagickConvertCommand = "D:\\ImageMagick-6.3.0-Q16/convert.exe";
$wgImageMagickConvertCommand = "D:\\ImageMagick-6.3.0-Q16/convert";
$wgImageMagickConvertCommand = "/usr/bin/convert";

with no luck on any of them.

Any tips to try would be very much «appreciated».

Try fixing the double slashes. That ought to do it. 69.153.141.224 02:59, 22 December 2006 (UTC)Reply

Following will be ok[edit]

## To enable image uploads, make sure the 'images' directory
## is writable, then set this to true:
$wgEnableUploads       = true;
$wgUseImageResize      = true;
$wgUseImageMagick = true;
#$wgImageMagickConvertCommand = "/usr/bin/convert";
$wgImageMagickConvertCommand = "C:/Program Files/ImageMagick-6.3.2-Q16/convert";

-- WonYong (Talk / Contrib) 06:42, 3 March 2007 (UTC)Reply


Unfortunately I have the same issue, I have my settings exactly as in this article (correct path ) however still get the error listed. Anyone else with any input?

Try just commenting the line $wgImageMagickConvertCommand, it went fine on my case.

If it's Windows, that last line should be:
$wgImageMagickConvertCommand = "C:/Program Files/ImageMagick-6.3.2-Q16/convert.exe";

Michael Daly 05:31, 17 July 2007 (UTC)Reply

Solution[edit]

--LouisCyphre 12:19, 12 March 2010 (UTC) I had troubles to get ImageMagick running under WindowsXP. Mediawiki 1.15.1 Xampp 1.7.3. Following did the trick:Reply

GlobalFunctions.php Line 2209 #$cmd = '"' . $cmd . '"';

The additional quotes caused the problem.

Bevor:
wfShellExec: ""C:\Programme\ImageMagick\convert.exe" -background white -size 102 "D:\xampp\htdocs\mediawiki/images/6/64/Tt.bmp" -thumbnail "102x120!" -depth 8 "D:\xampp\htdocs\mediawiki/images/thumb/6/64/Tt.bmp/102px-Tt.bmp.png" 2>&1" thumbnail failed on xxx: error 1 "" from ""C:\Programme\ImageMagick\convert.exe" -background white -size 102 "D:\xampp\htdocs\mediawiki/images/6/64/Tt.bmp" -thumbnail "102x120!" -depth 8 "D:\xampp\htdocs\mediawiki/images/thumb/6/64/Tt.bmp/102px-Tt.bmp.png" 2>&1"

After:
BitmapHandler::doTransform: running ImageMagick: "C:\Programme\ImageMagick\convert.exe" -background white -size 102 "D:\xampp\htdocs\mediawiki/images/6/64/Tt.bmp" -thumbnail "102x120!" -depth 8 "D:\xampp\htdocs\mediawiki/images/thumb/6/64/Tt.bmp/102px-Tt.bmp.png" 2>&1 wfShellExec: "C:\Programme\ImageMagick\convert.exe" -background white -size 102 "D:\xampp\htdocs\mediawiki/images/6/64/Tt.bmp" -thumbnail "102x120!" -depth 8 "D:\xampp\htdocs\mediawiki/images/thumb/6/64/Tt.bmp/102px-Tt.bmp.png" 2>&1 Request ended normally

Error creating thumbnail[edit]

Error creating thumbnail: Unable to run external programs in safe mode.[edit]

Similar error message: No such file or directory ... Error code: 127

I couldn't manage to install and run ImageMagick properly for my own wiki. I have the error msg as it's seen in the thread when i try to use thumbnailing code of wiki. Any detailed instruction or any web page i can find instruction would be highly appreciated. I also find an old version of ImageMagick which is pre-compiled. Is that usefull and easier to install?

Well, you can take off safe mode. If not then there is no point in installing ImageMagick. You will get the same error message. You could use GD::SVG, that is, if you can install it. If you are on host, that might not be an option because server needs to compile it. You can get a binary but your back to the safe mode restrictions. You could call GD directly, but the thumbs will not display correctly because GD does not support svg. In other words, if you cannot disable safe mode and you are on a picky sticky host then as current your options is most likely none. I would not be too concerned. Have a look wikipedia. They have a very large amount of png images with a template asking to move to svg because they might consider the time is right. You may consider a similar option. 03:18, 19 September 2007 — Preceding unsigned comment added by 24.83.74.255 (talkcontribs)
I experience the same problem. As I removed "$wgUseImageMagick = true;", the thumbnailing works well now. But SVG could not work yet. [I installed my wiki on a mandatory host, which I have no full control on it.] -- Senvey 04:30, 27 August 2008 (UTC)Reply
I just got the roo-cause was the PHP is in safe mode, which was probably set in php.ini. -- Senvey 06:18, 27 August 2008 (UTC)Reply
VERY strange that it works with "$wgUseImageMagick = true;" commented out, but the same here! Now thumbnailing works (all except svg), even with Safe Mode on (just use the correct safe mode exec dir etc settings)
I think when you disable wgUseImageMagick, MediaWiki use your previously created thumbnails so no error occured. Did you try to upload some new images and test its thumbnail? And remember that PHP config directives are not only in php.ini. If you installed PHP as Apache module, Apache's config file can effect PHP (see http://php.net/configuration.changes). To ensure that safe mode is off, you should create a .php file in the same directory with MediaWiki's index.php, fill it with the code <?php phpinfo();, and view it by browser. Cumeo89 02:38, 25 March 2009 (UTC)Reply
No, commenting out #$wgUseImageMagick = true; actually restores thumbnailing to newly uploaded images. SpiralOfYarn 23:56, 14 June 2009 (UTC)Reply
I have exactly the same problem. Rendering thumbnails always fails with the »Unable to run external programs in safe mode« error. In fact, at my own site safe_mode is off, as some short phpinfo() instantly proves! But what can I do? Disabling ImageMagick is not an option as GD seems to have problems with file names containing umlauts. I would really appreciate any hints! --77.179.108.82 21:57, 26 June 2009 (UTC)Reply
Yes, and look at this google search. Lots of people have this problem. Can't someone give an answer? Pardoned Turkey 01:53, 28 June 2009 (UTC)Reply
For me this error was caused by disable_functions including passthru. Removing passthru from the list of disabled functions made everything work great. If it still doesn't work try enabling Logging and see if that lists anything useful. -DavidSev 20:08, 1 September 2009 (UTC)Reply
Although safe mode is off by default in my host, but adding a php.ini using suPHP solved my problem. I dont understand it too. Stahn85 08:24, 13 November 2009 (UTC)Reply
My host has disabled passthru() in disabled_functions, is it possible to run imagemagick through exec() instead? 129.234.252.66 23:33, 11 December 2009 (UTC)Reply
Same here. Has there been a solution in the last months? --92.224.181.255 15:54, 3 December 2010 (UTC)Reply
This worked for my 1.15.2 install I removed "$wgUseImageMagick = true;", the thumbs works well now for old images uploaded that didn't work and for all new uploads. - Reggi 19:15 8 May 2014

ImageMagick don't work[edit]

ImageMagick show error: Unable to run external programs, proc_open() is disabled. Error code: 1

php.ini have string: disable_functions = exec,passthru,shell_exec,system,proc_open,popen

We delete function proc_open from disable and take work

disable_functions = exec,passthru,shell_exec,system,proc_open,popen

Error creating thumbnail: (using rsvg)[edit]

When uploading an svg image, I get a gray background and the words "Error creating thumbnail:" but with no explanation, etc. Here's what I have in SVG related code in LocalSettings.php:

$wgFileExtensions[] = 'svg';
$wgAllowTitlesInSVG = true;
$wgSVGConverter = 'rsvg';
$wgSVGConverterPath = "C:/Program Files/librsvg";

I've probably missed something stupidly important, but can someone please help??? Thanks! JonathanWiki 22:41, 27 September 2008 (UTC)Reply

Anytime I try to use the |thumb command or resize an image on my newly installed board I get the following error
 Error creating thumbnail: <br />
<b>Warning</b>: passthru() has been disabled for security reasons in <b>/home/iptvwiki/public_html/w/includes/GlobalFunctions.php</b> on line <b>2030</b><br />
Image upload works correctly and I can display the images full size, just no resizing. I have another wiki on the same host and that one works so I don't know what the problem may be. --MasterZ
See above, I changed all the posts with the same question to "Error creating thumbnail:" Rumpsenate 08:00, 17 July 2009 (UTC)Reply


I don't see the solution here, so I'll add what I found.

On the wiki run this to see what ImageMagick is trying to do with the SVG

convert -list delegate | grep 'svg ='

which gave me this output:

svg =>          "rsvg-convert' -o '%o' '%i"

However...

Command 'rsvg-convert' not found, but can be installed with:
apt install librsvg2-bin

When I installed that package, everything worked nicely again.

Error creating thumbnail: Not able to view images of pixels more than 800*600[edit]

screenshot of problem

Hi ALL

The error that i get:
Error creating thumbnail: The system cannot find the path specified.
Size of this preview: 800 × 600 pixels
Full resolution (2048 × 1536 pixel, file size: 813 KB, MIME type: image/jpeg)

And there is a blank grey screen , but when i click on the full resolution link, the image can be seen.This uploaded image can be seen nowhere on the wiki, even thumbnails give the same error.

Please help me on this !
--Ankit.madan 07:54, 7 September 2007 (UTC)Reply

Check that you don't still have the old imagemagick code enabled. I was having this problem and realized that in a fit of idiocy I tried to comment out the imagemagick variables in localsettings with ';' instead of '#'.
I'm running windows server 2008, I have found that you must manually go to the ImageMagick website, download and install the program, and set $wgImageMagickConvertCommand = "C:/ImageMagick/Convert.exe"; or whatever your directory is instead of /usr/bin/convert or whatever it is, since they design it for bloody linux only
--Pwgus 06:17, 9 October 2009 (UTC)Reply
Very large files always have this problem.
Here is one thread about this problem: Imagemagick will not create thumbnails for large images another: w:en:Wikipedia:Village_pump_(technical)/Archive_79#Error_generating_thumbnail_in_Milky_Way_article Adamtheclown 22:00, 17 January 2011 (UTC)Reply

Error creating thumbnail: SVG Error creating thumbnail[edit]

I hate to throw my problem to the masses but I've exausted all other available resources. I'm having exacly the problem this wiki is having in rendering my svg thumbnails. I'm using CentOS 5 in 64-bit mode, apache 2.2.3, php 5.1.6, mediawiki 1.12.0, ImageMagick 6.2.8, rsvg 2.16.1

LocalSettings.php

$wgFileExtensions[] = 'svg';
$wgAllowTitlesInSVG = true;
$wgSVGConverter = 'rsvg'; // or ImageMagick

ImageMagick error, as seen on this other person's wiki, appears instead of the image, no .png file is created at the thumbnail location

Error creating thumbnail: ERROR: meta.c (179): wmf_header_read: this isn't a wmf file
convert: Delegate failed `"wmf2svg" -o "%o" "%i"'.
convert: unable to open image `/tmp/magick-XXZSRth4': No such file or directory.
convert: unable to load module `/usr/lib64/ImageMagick-6.2.8/modules-Q16/coders/svg.la': libdbus-1.so.3: failed to map segment from shared object: Cannot allocate memory.
convert: unable to open file `/tmp/magick-XXZSRth4': No such file or directory.
convert: missing an image filename `PNG:/var/www/html/wiki/images/thumb/2/2c/Broom_icon.svg/400px-Broom_icon.svg.png'.

RSVG error, appearing in a log file, with a broken image on the page, no .png file is created at the thumbnail location (libcom_err.so.2 is installed through e2fsprogs-libs 1.39)

/usr/bin/rsvg-convert: error while loading shared libraries: libcom_err.so.2: failed to map segment from shared object: Cannot allocate memory

Following the syntax presented in $wgSVGConverters for ImageMagick or rsvg on the command line produces the proper png file from a valid svg file. DefaultSettings.php (unchanged)

$wgSVGConverters = array(
 'ImageMagick' => '$path/convert -background white -geometry $width $input PNG:$output',
 'rsvg' => '$path/rsvg -w$width -h$height $input $output',
);

I thought I might have a permission problem. Apache run with the user apache:apache, which owns all the web files. /tmp is publicly writable. I changed /var/html/wiki/Images/thumb to be publicly writable with no effect. I'd like to use svg's, if someone has a clue please help. I have a suspision that the wiki I linked also uses CentOS in 64-bit mode.

Please don't suggest upgrading software versions unless you are absolutely sure it fixes this particular issue. Software updates on CentOS are non-trivial and have repercusions in the enterprise environment. If you have are having this issue, please also pipe in, and people might take the issue more seriously. Thanks for your time. Quadir

You may try to increase shell memory limits in LocalSettings.php, e.g.
$wgMaxShellMemory = 131072;
This helped for me with rsvg - the default 102400kB in DefaultSettings.php turned out to be a bit too small.
This question was asked before, with some answers:
Error creating thumbnail: Unable to run external programs in safe mode. (above)
It appears like this problem is very common, with over 9,000 pages having the same problem.[1]
Rumpsenate 07:35, 17 July 2009 (UTC)Reply
I was also getting the wmf_header_read error with ImageMagick. It would work fine from command line, but I never got it to run from MediaWiki. I ended up just switching to RSVG (add $wgSVGConverter = 'rsvg'; to localsettings). --Quantum7 (talk) 00:26, 18 October 2012 (UTC)Reply

Error creating thumbnail command not found[edit]

Error creating thumbnail: sh: wmf2eps: command not found
convert: Delegate failed `"wmf2eps" -o "%o" "%i"'.
convert: unable to open image `/tmp/magick-XX2SuF3Y': No such file or directory.
convert: unable to open file `/tmp/magick-XX2SuF3Y': No such file or directory.
convert: missing an image filename `PNG:/home/FOLDER NAME/public_html/WIKI
NAME.com/images/thumb/b/b4/Gtk-dialog-info.svg/60px-Gtk-dialog-info.svg.png'.

Above is my full error, in a gray box.

See also:

mwusers.com has several posts on this problem.

I also found this: Thumbnails_Not_Working

Also this posting: Using ImageMagick in Mediawiki i have to chmod 777 the image/thumb/ directory to get it working.

Rumpsenate 12:44, 17 July 2009 (UTC)Reply

I found that this occurred because of limits being too low. I fixed it with the following setting:

$wgMaxShellMemory = 202400;

Alphasee Thank you Rumpsenate. This immediately fixed my problem. I don't know why this information isn't more readily available. ^^ Fixes MediaWiki's ability to parse SVG files.

CompuMatter Ditto Here at CompuMatter. Thanks Rumpsenate. Instant fix. What an obscure connection.

Grantiago Thanks Rumpsenate. Instant fix after lots of other searching and editing and non-fixes.

Really appreciate your fix, Rumpsenate! After hours pulling out my hair trying to fix this issue, I found your solution and now it's solved. Davydog (talk) 04:51, 2 November 2013 (UTC)Reply

-Hello, i have some problem too. I have change the access to chmod 777 to images/thumb/ directory and still cannot see Thumbnail. My configuration at LocalSettings.php was like:

$wgFileExtensions[] = 'svg';
$wgSVGConverter = 'ImageMagick';
$wgMaxImageArea = 100 * 1000 * 1000;
$wgMaxShellMemory = 100000;

What wrong at my code?Please give me suggestions. Thank you--Sephirothindra (talk) 02:59, 21 June 2013 (UTC)Reply

Error creating thumbnail convert: missing an image filename[edit]

Error creating thumbnail: convert: missing an image filename `/home/wiki/images/thumb/4/4c/foo.pdf/page1-120px-foo.pdf.png' @ convert.c/ConvertImageCommand/2766.

I was getting this error. I checked the MediaWiki Error log and found this:

thumbnail failed on hanley.site5.com: error 1 "convert: missing an image filename 
`/home/wiki/images/thumb/archive/4/4c/20100820211347!foo.pdf/page1-120px-foo.pdf.png' 
@ convert.c/ConvertImageCommand/2766." from "('/usr/bin/gs' -sDEVICE=jpeg -sOutputFile=- 
-dFirstPage=1 -dLastPage=1 -r150 -dBATCH -dNOPAUSE
-q '/home/wiki/images/archive/4/4c/20100820211347!foo.pdf' | '/usr/bin/convert' -depth 8
-resize 120 - '/home/wiki/images/thumb/archive/4/4c/20100820211347!foo.pdf/page1-120px-
foo.pdf.png') 2>&1"

So I ran gs manually:

# /usr/bin/gs -sDEVICE=jpeg -sOutputFile=- -dFirstPage=1 -dLastPage=1 -r150 -dBATCH \
-dNOPAUSE -q '/home/wiki/images/4/4c/foo.pdf'
Segmentation fault (core dumped)

It turns out we have a really old version of gs:

# gs -v
GNU Ghostscript 7.07 (2003-05-17)
Copyright (C) 2003 artofcode LLC, Benicia, CA.  All rights reserved.

I ran this under gdb. definitely crashing:


I ran it under the debugger. Definitely crashing!
(gdb) bt
#0  0xaa6f4a3a in gx_device_retain () from /usr/lib/libgs.so.7
#1  0xaa5d15ad in gx_begin_image3x_generic () from /usr/lib/libgs.so.7
#2  0xaa5d18ae in gx_begin_image3x_generic () from /usr/lib/libgs.so.7
#3  0xaa730d69 in gx_default_begin_typed_image () from /usr/lib/libgs.so.7
#4  0xaa5d46e9 in art_pdf_composite_knockout_8 () from /usr/lib/libgs.so.7
#5  0xaa6fbea5 in gs_image_begin_typed () from /usr/lib/libgs.so.7
#6  0xaa5b13dd in zimage_setup () from /usr/lib/libgs.so.7
#7  0xaa5d0269 in s_zlib_free () from /usr/lib/libgs.so.7
#8  0xaa5919d3 in gs_interpret () from /usr/lib/libgs.so.7
#9  0xaa588815 in gs_main_outwrite () from /usr/lib/libgs.so.7
#10 0xaa5889ea in gs_main_run_string_end () from /usr/lib/libgs.so.7
#11 0xaa588b29 in gs_main_run_string_with_length () from /usr/lib/libgs.so.7
#12 0xaa588b71 in gs_main_run_string () from /usr/lib/libgs.so.7
#13 0xaa58940c in errflush () from /usr/lib/libgs.so.7
#14 0xaa58979c in gs_main_run_start () from /usr/lib/libgs.so.7
#15 0xaa74318f in gxclip2_dummy () from /usr/lib/libgs.so.7
#16 0x00000003 in ?? ()
#17 0x00000800 in ?? ()
#18 0x0805899c in ?? ()
#19 0xbf8cc8b8 in ?? ()
#20 0x00000072 in ?? ()
#21 0xbf8cc960 in ?? ()
#22 0xaa411b99 in vsscanf () from /lib/tls/libc.so.6
Previous frame inner to this frame (corrupt stack?)

Solution: ghostscript 8.71 (from ghostscript.com). This no longer crashes. (Note: 8.64, available from the GNU site, still crashes.)

This is ghostscript bug 689150.

Error Creating Thumbnail - Image Magick Not Found[edit]

I installed Image Magick to the following directory: C:\ImageMagick

In my LocalSettings.php file are the following fields: $wgEnableUploads = true; $wgUseImageResize = true; $wgUseImageMagick = true; $wgImageMagickConvertCommand = 'C:/ImageMagick/convert.exe'; $wgFileExtensions[] = 'svg'; $wgAllowTitlesInSVG = true; $wgSVGConverter = 'ImageMagick'; $wgSVGConverterPath = "C:/ImageMagick";

But when I upload a jpg, I get the following error: Error creating thumbnail: /home/content/90/5181590/html/bramtonpedia/bin/ulimit4.sh: line 4: C:/ImageMagick/convert.exe: No such file or directory

When I upload a svg, I get this message: Error creating thumbnail: /home/content/90/5181590/html/bramtonpedia/bin/ulimit4.sh: line 4: C:/ImageMagick/convert: No such file or directory

I know it's there. Why doesn't MediaWiki?

Bramton1 21:25, 7 November 2009

Error creating thumbnail (SVG) for MediaWiki 1.15.x and Windows[edit]

For weeks I have try to rasterize SVG image using 3rd party tools, and none of them work. That includes adjusting $wgMaxShellMemory, $wgSVGConverters array and etc. Opening the log reveals no specific error details on what causes it to failed. Checking out the $wfShellExec in GlobalFunctions.php reveals it could not run any command line with slashes! It had to be replaced with black slashes!

Open up your GlobalFunctions.php and look for $cmd = '"' . $cmd . '"';. It should be replaced with $cmd = 'cmd /C ' . '"' . str_replace( '/', '\\', $cmd) . '"';

The cmd /C indicates to terminate program once execute that line of command.

And the output should be:

	} elseif ( php_uname( 's' ) == 'Windows NT' ) {
		# This is a hack to work around PHP's flawed invocation of cmd.exe
		# http://news.php.net/php.internals/21796
		#$cmd = '"' . $cmd . '"';
		$cmd = 'cmd /C ' . '"' . str_replace( '/', '\\', $cmd) . '"';
	}
	wfDebug( "wfShellExec: $cmd\n" );

Also, in v1.15.x, there isn't any need to add a few variables at LocalSettings.php. All you need is to adjust variables at DefaultSettings.php. Look out for the SVG settings in it and change it accordingly.

That should work.

zaidaiman 08:53 April 10, 2010

If uploading files continues to throw permission errors, check the permission settings for c:\Windows\Temp, NETWORK USER may need to have Read and Write permission for ImageMagick to work.

PyroNemisis August 6, 2012

Error creating thumbnail: ImageMagick returning exit code 2[edit]

This is likely the same problem as some of the ones mentioned before, but the symptoms look a little different, so i thought i'd add another post here.

After an OS upgrade on DreamHost, i started seeing errors like these in the log whenever ImageMagick tried to resize images (and they were small-ish JPEGs, stuff that'd always worked before):

thumbnail failed on washingtondc: error 2 "" from "'/usr/bin/convert' -quality 95 -background white -size 120 '/home/user/website.com/w/images/5/5c/Image.jpg' -thumbnail '120x90!' -set comment 'File source: http://website.com/wiki/File:Image.jpg' -depth 8 -sharpen '0x0.4' '/home/user/website.com/w/images/thumb/5/5c/Image.jpg/120px-Image.jpg' 2>&1"

The articles themselves just said 'Error creating thumbnail', with no other explanation.

Finding nothing on 'error 2' in either MediaWiki or ImageMagick's documentation, i decided to play with things myself, and it turned out that, as above, it was a memory-limiting problem. Doubling the default value continued to cause issues, so i'm currently doing this:

$wgMaxShellMemory = 512000;

Not sure if newer versions of ImageMagick require more memory, or if DreamHost changed something else, but that's done the job so far. — 75.173.171.241 23:10, 20 October 2011 (UTC)Reply


I can confirm the exact situation, setup, host and solution --Ceaser (talk) 12:38, 29 September 2013 (UTC)Reply

Error creating thumbnail: File seems to be missing[edit]

I recently changed servers, and am getting this error for a few images. I can see the image is in the correct folder in the file system. It's on a godaddy shared hosting plan, and I have verified GD libarys are available and I have activated Image Magik and confirmed the path is correct. I have also set the image folder to 777.

Any idea what could be causing this? --- im having the same issue and can't figure out what's going on.

Error using thumbnail: even if ImageMagick works with other Scripts.[edit]

My ImageMagick Installation uses /usr/local/IM6/bin/ .

This Configuration works well at my vBulletin Forum and on Typo3 and a Joomla CMS.

I have changed this Path at my LocalSettings.php but it still says to me at the Articel:

"Fehler beim Erstellen des Vorschaubildes: sh: line 1: /usr/local/IM6/bin/: is a directory "

  • I have the same problem - any idea?
    • I think you need to point directly to convert and not just the directory it's in

Error SVG[edit]

I can't upload SVG. manual is not work.

Copy all LocalSettings.php file contents to here, please. -- WonYong (Talk / Contrib) 06:47, 3 March 2007 (UTC)Reply

It would help if you would post the actual error message. -- Duesentrieb 10:45, 3 March 2007 (UTC)Reply

Error 139 (No image creation, Some memory, core error) with ImageMagic and solution[edit]

  • ImageMagick itself worked on the command line, but no thumbnail creating within mediawiki(actually I got stubs containing only the header of an gif)
  • First turn on Debugging: $wgDebugLogFile = "/tmp/wiki.log"; (before you see only stubs in the thumb folder and no more message)
  • It always said error 139, not anything more
  • I figured out it was a problem with ulimit4.sh (/usr/share/mediawiki/bin/ulimit4.sh for my Fedora-distro)
  • I didn't find another way as that ulimit -v and -f Parameter should be unlimited (If to low I got a segfault, if to high I got a "memory not allocatable" fault)
  • To achieve this behaviour:
$wgMaxShellMemory   = unlimited;
$wgMaxShellFileSize = unlimited;
  • These values get directly passed to the ulimit4.sh and this works for me.

Cyber1000, 21 March 2010

The above is correct but does not include what I searched for. It was missing the key phrases of "Segmentation fault" and "core dump". I did not find it until I came to add a new section. So I am adding a bit more information. The log message I had was:

/home/johne/public_html/wiki/bin/ulimit4.sh: line 4: 20510 Segmentation fault      (core dumped) '/usr/bin/convert' -quality 80 -background white -size 120 '/home/johne/public_html/wiki/images/8/82/1978-04-29_Toronto_ticket.jpg' -thumbnail '120x65!' -depth 8 -sharpen '0x0.4' '/home/johne/public_html/wiki/images/thumb/8

I did not have to make $wgMaxShellMemory unlimited. I only doubled it. I did not touch $wgMaxShellFileSize since the size of thumbnails should be well below any file size limit imposed. JoelSherrill, 18 December 2010

Success!!! Image Thumbnailing in XAMPP 1.7.7[edit]

  1. Installed XAMPP v1.7.7 VC9 and vcredist.exe
  2. Installed ImageMagick for Windows from Dynamic ImageMagick from:
http://www.imagemagick.org/download/binaries/ImageMagick-6.7.5-6-Q16-windows-dll.exe
  1. OpenSSL extension DLL (Dynamic Extension) is available in XAMPP v1.7.7 but needs an entry in the php.ini file
extension=php_openssl.dll
  1. Restart Apache
  2. Setup the database and installed MediaWiki v1.18.1
  3. Create the tmp folder in the default mediawiki thumbnailing images path or set a custom one.
  4. Appended the following to the LocalSettings.php file:
$wgEnableUploads  = true;
$wgUseImageMagick = true;
$wgUseImageResize = true;
$wgTmpDirectory   = true;
$wgImageMagickConvertCommand = "C:/Program Files/ImageMagick-6.7.5-Q16/convert";

Note the use of forward slashes and the absence of the .exe extension in the convert binary in the last line above.

Now thumbnailing will work!

Success!! Image thumbnailing[edit]

-- WonYongTalk 04:43, 4 December 2007 (UTC)Reply

I installed mediawiki on Windows XP I use ImageMagick-6.3.2-Q16

Following is my source file:

## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
$wgScriptPath       = "/mediawiki";

$wgFileExtensions[] = 'svg';
$wgAllowTitlesInSVG = true;

$wgSVGConverters = array(
    'ImageMagick' => '"C:/Program Files/ImageMagick-6.3.2-Q16/convert" -background white -geometry $width $input $output',
  );


$wgSVGConverter = 'ImageMagick';

## For more information on customizing the URLs please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL

$wgEnableEmail      = true;
$wgEnableUserEmail  = true;


Following is seemed to be Linux environment

## The URL base path to the directory containing the wiki;
## defaults for all runtime URL paths are based off of this.
$wgScriptPath       = "/mediawiki";

$wgFileExtensions[] = 'svg';
$wgAllowTitlesInSVG = true;

$wgSVGConverter = 'ImageMagick';

## For more information on customizing the URLs please see:
## http://www.mediawiki.org/wiki/Manual:Short_URL

$wgEnableEmail      = true;
$wgEnableUserEmail  = true;

-- WonYong (Talk / Contrib) 02:50, 6 March 2007 (UTC)Reply

Image thumbnailing and resizing: intelligent program analysis of image content[edit]

Why does MediaWiki make unnecessary Thumbnails? e.g; on Image:USDA Hardiness zone map.jpg the "higher resolution" image is only slightly different from the the "thumbnail", and it is therefore wasteful to bother producing one instead of showing the actual image. --belg4mit

Because we suck, we're all incompetent, bad programmers, and MediaWiki is doubtless the most ridiculous piece of software out there, and thus not suitable for your use. I would strongly advise using an expensive, proprietary solution, where your developers are paid and have time to listen to unhelpful criticism. robchurch | talk 13:38, 10 July 2007 (UTC)Reply

--

  Peter Blaise trys a response: Hi belg4mit. I think what Rob is suggesting in his own unique and witty way is that MediaWiki is OpenSource at it's most dynamic. So ... JUMP IN and make it what you'd prefer! Perhaps YOU can suggest AND PROGRAM your own enhancements to the existing MediaWiki programming that would meet your needs, and benefit all subsequent users. In other words, I think Rob is suggesting that we all stop asking others for the enhancements we want, and get to work creating the changes we want for ourselves. And then, like the programmers before us, Rob included, upload our solutions for all others to share and improve upon. Have I got it, Rob?  ;-)
  So, belg4mit, I think we are all aware that "stupid" is too general a word, and could apply to programmers as well as to programs and to users, and apparently in your case, to a mismatch between your preferences and the defaults of the programmer's choices that came before you. So, make it intelligent by your standards. Then it's up to others to asses your preferences as stupid for their own purpses or not, and improve from there. OpenSource is messy and evolves in spits and spurts, and may never be perfect for everyone all at the same time. I think my own MediaWiki setup choices, tough appropriate for our group, might frustrate other MediaWiki users. It's all custom. So, belg4mit, I look forward to your contributions, and seeing your configuration settings and custom program enhancements. Why not start a contribution list of your own at User:Belg4mit and let us keep track of your solutions and give you our useful feedback?
  By the way, I know of no "intelligent" image manipulation program out there, anywhere, on or off MediaWiki, at any price. That is, I know of NO image program that intelligently makes decisions based upon the contents of the image, especially "smart" resizing. If anyone knows of any such tools, PLEASE share links here, and let's see if we can incorporate them into MediaWiki. In the meantime, I've renamed this thread from "Stupid sizing" to "Image thumbnailing and resizing: intelligent program analysis of image content". There are more than 1 million links resulting from a Google.com search for "+intelligent image manipulation" - overwhelming, but it's a place to start. Essentially, it's advice to the person running any image program to do that "intelligent" analysis on their own, in their own mind's eye, before saving! Otherwise, everyone should be advised that any image appearing on any MediaWiki screen is the result of someone's active or default choices, and may appear useful, or not, to the subsequent viewer ... and may also be dependent somewhat on the end user's browser settings and screen resolution and settings. Check yours at http://gemal.dk/browserspy/ - mine is ~96dpi, and these letters are ~1/8th inch (~3mm). What's yours?
  -- Peter Blaise peterblaise 17:54, 10 July 2007 (UTC)Reply

Uploaded SVG images don't look correct[edit]

Hi all,

I've been trying to add a couple .svg images to my new wiki (1.10), and for the life of me, I can't them to look like they do here.

For example, this is your file:

and this is what happens why I put it in my wiki (and it scales horribly, too):


I've tried this with ImageMagick and Inkscape, and they look the same. I'm guessing its a parameter in the LocalSettings file, maybe in here:

$wgSVGConverters = array(

   'ImageMagick' => '"C:/Program Files/ImageMagick-6.3.5-Q16/convert" -background white -geometry $width $input $output'

);

Any ideas? Nate

Also, is there anyone from mediawiki that could tell me what converter mediawiki.org is using? And maybe the applicable settings in the LocalSettings file? I'm certain it has something to do with that. Thanks!

--Natebsi 18:53, 18 July 2007 (UTC)Reply

All the official projects use rsvg -Steve Sanbeg 18:45, 17 August 2007 (UTC)Reply

Thumbnail circular reference[edit]

If you click on the link in this article for info on thumbnailing to go to the File Upload page, it presents a link back to this page.Michael Daly 02:36, 31 August 2007 (UTC)Reply

How Do I Change the Default Resolution for Medium-Sized Thumbnails?[edit]

I am using a skin that sets the globalwrapper div (and hence, the main content area) to a fixed width, 850px, including the navigation menus. When I upload a large image, the medium-sized thumbnail often extends beyond the boundary of the main content area, and it looks really bad. What could I do to make the default resolution for the medium-sized thumbnail a bit smaller? I have some knowledge of PHP but don't know where to look for this setting. Thanks.

I am using the GD Library, but if I have to, I'll get Image Magick.

--Wikitonic 22:05, 27 September 2007 (UTC)Reply

UPDATE: I checked inside the thumbnail directory and now I see that each upload is automatically resized to 5 different resolutions (180px, 300px, 350px, 500px, and 800px). So let me rephrase the question, by splitting it up into two questions. (1) How can I have MediaWiki display the 500px thumbnail instead of the 800px thumbnail when you go directly to an image's page (image:xxx.jpg)? Or, (2) Is there any way to have the resizing script create the largest thumbnail to be slightly less than 800px (e.g. 650 or 700px instead of 800px)? Either solution will work fine for me.

--Wikitonic 18:06, 1 October 2007 (UTC)Reply

UPDATE: For anyone dealing with the same problem, you can find the answer at manual:$wgImageLimits.
--Wikitonic 15:31, 29 October 2007 (UTC)Reply
Thanks for that link, that's exactly what I was looking for!
--97.97.177.148 00:46, 3 September 2010 (UTC)Reply

Thumbnailing Instructions Incomplete or Inconsistent?[edit]

"To enable image thumbnailing, set ... $wgUseImageMagick to true ..." Even when using only GD?

"Make sure the $wgImageMagickConvertCommand variable points to the proper location of the convert command of your installation ...." What would this be for the GD included with WAMP?

Rebuilding Thumbnails[edit]

I had permissions problems following MediaWiki installation, and no thumbnails were created following importImage.php. Is there a simple admin script to sweep through to rebuild thumbnails in their hash directories? Many thanks Gaudete 15:30, 13 November 2007 (UTC)Reply

There could've been any number of things wrong in this situation, but since a web search for "mediawiki rebuild thumbnail" may land some folks here, a possible solution is discussed at Manual:$wgThumbnailEpoch#Details; that is, to set $wgThumbnailEpoch to a current timestamp, forcing thumbnails to be regenerated on demand. --Ernstkm (talk) 18:57, 10 December 2020 (UTC)Reply

SVG[edit]

Hello,

I have a problem with svg files on my local wiki. I have allowed the upload of the SVG files so now I can upload such files, no problem with this part. But I don't understand the 'part 2' : "Second, set $wgSVGConverter to the renderer you want to use" : I imagine that it isn't enough just to say "I want to use rsvg or magick", but that you have to install it on the server. I don't know how to do that, can anyone help me ? by advance, thanks Malta 13:36, 19 November 2007 (UTC)Reply

en:User:WonYong/SVG setting I write this for you. :) -- WonYongTalk 04:40, 4 December 2007 (UTC)Reply

Cannot delete images as Admin[edit]

Hi, I have the problem that I get an error message when trying to delete images from our wiki. It says: "Error deleting file: Could not create directory "deleted/5/t/w"." And the there is one long line with a message right in my wiki. It says that the permission is denied in a certain directory and ends with "...GlobalFunctions.php online 1670" Can anybody help me with that? My best, --Gollum 19:30, 8 December 2007 (UTC)Reply

Hey Gollum, I had the same issue on my 1.11.0 instance - a 777 chmod on /images/deleted seemed to work. --Chrys 16:08, 5 January 2008 (UTC)Reply
Yes, that's it! Thank you! --Gollum 00:46, 6 January 2008 (UTC)Reply
In my case, all subdirectories in the images directory except the subdirectory "deleted" were owned by apache, so "chown apache:apache deleted" solved the error for me and made it possible to delete the file.

Are deleted images still stored?[edit]

I wonder if deleted images are still stored in MW 1.8.2. and if so how can I delete those deleted images? Thanks! ~~subfader

Resizing of Some GIFs Rendering Poorly; Setting Needs Changing?[edit]

The resizing of images for thumbnails generally works great, but for some reason it does not for a small subset of images. This subset seems to be GIF images with large transparent backgrounds, e.g. logos. When they are being resized, some of the foreground is being dropped. This dropping does not occur if you resize in Photoshop. Could it be that a simple change in setting is needed?

Examples:

External applications[edit]

The notes for using external apps to render svg are a little confusing for someone unfamiliar with adding applications to web servers. I use a shared Linux server with the most recent Mediawiki loaded onto it. I'd like to use the same renderer as wikipedia, but it seems that is only for gnome environments - is that right? How (if you can?) do you install Imagemagic or anything else via ftp? Surely you don't put it on your local machine, else how will it work when other people view the svg files? Any pointers on how to get a svg renderer onto my server would be gratefully welcomed. RS

Image Renaming[edit]

Well i have done some searching and as of yet i have found a good solution or answer that will allow me to Rename an image. For the most part, until recently, the names of my images were a combined name (ie MediaWiki.jpg) instead of a representative name (ie Media_Wiki.jpg) Yes i know the underscore is evaluated as a space but it still files it as such with the underscore.

If renaming is not possible, then how about considering updating the mediawiki template to allow pictures to be considered moveable much like the other pages. Currently i am forced to delete them and upload the same image with the correct naming format.

Goldbishop 18:42, 8 April 2008 (UTC)Reply

Unfortunately, image renaming is still impossible (see bug 709). —Emufarmers(T|C) 21:26, 8 April 2008 (UTC)Reply
Now it's possible, see Manual:$wgAllowImageMoving. Already enabled in MW 1.14, needs to be set to true in MW 1.13. Capmo 03:30, 3 May 2009 (UTC)Reply

PDF Thumbnails?[edit]

I host many PDFs on my wiki, and in order to get a proper thumbnail, I first have to export the PDF as an image, upload that image, then link it to the PDF in question. Imagemagick can work with PDFs already. Here are some examples. Imagemagick itself says that it's not the best tool for vector-vector conversion, but we're not trying to do that, all we want is a preview thumbnail for uploaded PDF files, instead of that hokey adobe icon. Is it possible to add this functionality? Where in the code would it exist in the first place?


I can assume you're over the hurdle of allowing your users to upload PDF files, by adding pdf to $wgFileExtensions. Beyond that, Extension:PDFHandler (which comes with MediaWiki ≥1.21) will take care of the thumbnails. In addition to having proper thumbnails for uploaded PDFs, you can page through bitmap previews of the slides at the image description page (File: namespace), and you can use the pseudo-namespace Media: to point directly at the PDF file (e.g., [[Media:Uploaded_file.pdf]]), which most browsers will display inline. It all works surprisingly well. --Ernstkm (talk) 22:10, 23 April 2020 (UTC)Reply

Rename images[edit]

I can't find any information about renaming images anywhere. My Wiki-users are uploading images without renaming them. Now I have a lot of images named "135.jpg" and other numbers. I want to rename images so that the image-name describes what's in the picture. But how? /Abbedabb 10:15, 30 May 2008 (UTC)Reply

Use $wgAllowImageMoving = true; in LocalSettings.php. See also bugzilla:15842 and bugzilla:709.

The default value of $wgAllowImageMoving is true since MediaWiki 1.14+. If you're concerned about the underlying filename on the filesystem, that will probably take more effort than is worthwhile. However, if you just want the resource in the File: namespace to be renamed (this is the name you would use when inserting an image link, then you simply "move" the page. You may also be interested in Manual:moveBatch.php for a more automated solution. --Ernstkm (talk) 22:21, 23 April 2020 (UTC)Reply

SVG on hosting server[edit]

Hello. I'm using Mediawiki on a hosting server, and i have no access to the files outside the website directory. So i don't think i can install a svg converter there.

Is there an alternative solution for enabling SVG thumbnail?

Thanks a lot. Crlf0710 07:32, 9 February 2009 (UTC)Reply

Looking for video tutorial[edit]

I'm definitely a MediaWiki noob, so I've been looking for the for a good tutorial on ImageMagick (preferably with images or a video walkthru). Can anyone point me in the right direction? Thanks. Cannedgoods 00:01, 23 March 2009 (UTC)Reply

You don't need to know anything about ImageMagick to use it with MediaWiki; you just need to download and install it (you might be able to use your operating system's package manager instead). —Emufarmers(T|C) 20:27, 24 March 2009 (UTC)Reply
You mean to istall it to the web server? How?--Juan de Vojníkov 14:07, 20 December 2009 (UTC)Reply

Which renderer ?[edit]

Which renderer do the wikimedia sites including commons and wikipedia use as their svg renderer?

anyone know?

librsvg --NachoDuck 15:52, 7 September 2010 (UTC)Reply

Batik refuses to render SVG images.[edit]

Using: Mediawiki version 1.15.1, OS: Ubuntu 8.04.3 LTS, PHP 5.2.4, Apache 2.2.8

Attempting to render SVG graphics I get this error instead of the thumbnail or image:

Error creating thumbnail: Exception in thread "main" java.lang.NoClassDefFoundError: org.apache.batik.i18n.LocalizableSupport at org.apache.batik.apps.rasterizer.Messages.<clinit>(Messages.java:48) at java.lang.Class.initializeClass(libgcj.so.81) at org.apache.batik.apps.rasterizer.Main.<clinit>(Main.java:299) at java.lang.Class.initializeClass(libgcj.so.81)

Have downloaded batik 1.7 binaries, and have decompressed (using JAR) to /usr/share/java/ This seems to make MediaWiki reference and use the Batik java system, as I was receiving a completely different error before regarding the rasterizer jar file not being found. Now with the change, it spits the aforementioned error.

Have entered in LocalSettings.php: $wgAllowTitlesInSVG = true; $wgSVGConverter = batik; $wgSVGConverterPath = "/usr/share/java/";

Have searched everywhere on the web - no clues. Can break it further by removing the Java files, so this proves the Java is being loaded for Batik. It just doesn't work.

Could this be a missing dependency in Ubuntu, rather than an actual code problem?

As this is breaking my head for 2 days now I'm going to ditch Batik as it has wasted my time. I write this in the hope I can help someone else avoid using this mistake piece of software.



Update: I have successfully rendered SVG images using ImageMagick. Initial configuration: $wgAllowTitlesInSVG = true; $wgSVGConverter = 'ImageMagick'; $wgSVGConverterPath = "/usr/bin/";

This did not work straight away, due to missing dependency: libwmf-bin This provided previously missing wmf2eps binary.

I employed this change to LocalSettings.php:

$wgMaxShellMemory = 131072;

And used chmod 777 on the thumb directory under the images directory.

eg: chmod 777 /usr/share/mediawiki-1.15.1/images/thumb

And now all is working well.

I say the main page for SVG images should recommend ImageMagick. I dont understand why it is considered to do a poor job, seems to work just fine here.


Using browser scaling for PNG thumbnails[edit]

I hacked my old MW 1.8.x to use the *actual* PNG image and let the browser scale it downward for thumbnails, as the bundled GD library seemed to fail miserably when it came to creating anything comparable in quality to that of JPG thumbnails (even when I upgraded GD to the latest version). ImageMagick wasn't an option for me. I present it here in the hope that in the future we can skip PNG thumbnailing via a config option, given how many problems I've read about it in various discussion groups.

 '''File:'''     includes/Image.php
 '''Function:''' function getThumbnail( $width, $height=-1, $render = true ) {
 '''Find:'''
 			if ( $render ) {
 				$thumb = $this->renderThumb( $width );
 
 '''Replace with:''' 
 			if ( $render ) {
 				if ( $this->getMimeType() == 'image/png' ) {
 					$thumb = new ThumbnailImage( $this->getURL(), $width, $height );
 				} else {
 					$thumb = $this->renderThumb( $width );
 				}

 '''File:'''     includes/Linker.php
 '''Function:''' function makeThumbLinkObj( $img, $label = '', $alt, $align = 'right', $boxwidth = 180, $boxheight=false, $framed=false , $manual_thumb = "" ) {
 '''Find:'''
 			$s .= '<a href="'.$u.'" class="internal" title="'.$alt.'">'.
 				'<img xtest=0 src="'.$thumbUrl.'" alt="'.$alt.'" ' .
 				'width="'.$boxwidth.'" height="'.$boxheight.'" ' .
 				'longdesc="'.$u.'" /></a>';
 '''Replace with:''' 
 			$s .= '<a href="'.$u.'" class="internal" title="'.$alt.'">'.
 				'<img xtest=0 src="'.$thumbUrl.'" alt="'.$alt.'" ' .
 				'width="'.$boxwidth.'" xheight="'.$boxheight.'" ' .
 				'longdesc="'.$u.'" /></a>';

In case the change in the second file isn't obvious: I intentionally broke height parameter, as the '-1' default was causing the browser to correctly render the original image as a thumbnail, albeit with a corrected height of 1px; not specifying height leaves the browser to render the thumbnail image height according to its aspect ratio. Tested on IE only. --Gth-au 04:13, 3 November 2009 (UTC)Reply

Ban on creation of thumbnails format .gif[edit]

Hello! The problem is that if I load the image, the size of 1mb, miniature get much larger. Please'll show how to disable the creation of thumbnails for .gif. How to reduce the quality of thumbnails? Why miniature size larger than the original?

Example [4] original 56Kb, miniature 328kb!

Can't make librsvg work.[edit]

I have downloaded the latest snapshot of RSVG. Uploaded the librsvg folder on my shared hosting account in Godaddy: /webwiki/svgconverter/. And added the $wgSVGConverterPath = "$IP/svgconverter/librsvg"; and $wgSVGConverter = 'rsvg'; in the LocalSettings.php. Unfortunately,

Error creating thumbnail: /home/content/94/4582794/html/webwiki/bin/ulimit4.sh: line 4: /home/content/94/4582794/html/webwiki
/svgconverter/rsvg: No such file or directory

I think i am doing something wrong with librsvg. I can't find any reliable documentation on how to use it.

I take it you're on a shared hosting service (judging by your mention of GoDaddy and the error you provided). librsvg needs to be installed on the server and requires root access to do so, you might want to ask your host if it's installed and what the current path to it is. --NachoDuck 15:56, 7 September 2010 (UTC)Reply


Can't disable the SVG render[edit]

I want to use svg images in my wiki, but the render can not be shut down. That's anoying as hell, because everyone who uses the wiki has a firefox 3.x and so svg images can be viewed crystal clear with native support.

LocalSettings.php for image folder symlink[edit]

Hi, I have two websites on the same topic and I am trying to use one image folder so that both websites can share the same images. I have used symlinks for one website (kesihatan) pointing to the image folder of the other website (health). What else do I need to do? I tried:

$wgUploadPath       = "images"; 
$wgUploadDirectory  = "images"; 
$wgAllowExternalImages = true;

but it is not working. I also tried

$wgUploadPath = "../health/images";

Any help deeply appreciated. — PM Poon 20:55, 10 June 2011 (UTC)Reply

I think you may be looking for Wiki family. Beta M 15:57, 11 July 2011 (UTC)Reply

Thumbnailg animated PNGs[edit]

It seems like blogger and blogspot are able to keep the animation in animated PNGs when they are resized. Is there a way to get this working on MediaWiki?

Problems rasterizing SVG files[edit]

Hi. If anyone happen to be stack with old version of rsvg (like in CentOS 5) and you have probelms with national/local/special characters then there is hope!

First you add this to LocalSettings.php:

$wgMaxShellMemory = 0;
$wgAsciifySvgFileBeforeRasterize = true; // only if you use below

This BTW speeds up processing image pages A LOT.

Then - if you still have problems - you should change your includes/media/SVG.php file so that rasterize function is:

	public function rasterize( $srcPath, $dstPath, $width, $height ) {
		global $wgSVGConverters, $wgSVGConverter, $wgSVGConverterPath, $wgAsciifySvgFileBeforeRasterize, $wgUploadDirectory;
		$err = false;
		
		// Nux: Asciify Svg File Before Rasterize : START
		$allowdedAsciiRegexp = '/^[a-zA-Z0-9\-\/\\_\.]+$/';
		$asciifiedSvgFile = false;
		if ( $wgAsciifySvgFileBeforeRasterize == true && !preg_match($allowdedAsciiRegexp, $srcPath) ) {
			// change src path to something simple
			$srcPathTmp = $srcPath;
			$dstPathTmp = $dstPath;
			$srcPath = "{$wgUploadDirectory}/tmp.svg";
			$dstPath = "{$wgUploadDirectory}/tmp.png";
			// copy src file
			if ( !copy( $srcPathTmp, $srcPath ) ) {
				wfDebug( __METHOD__.": failed to copy src: $srcPathTmp to $srcPath\n" );
				// copy file - let's try without Asciify...
				$srcPath = $srcPathTmp;
				$dstPath = $dstPathTmp;
			} else {
				$asciifiedSvgFile = true;
			}
		}
		// Nux: Asciify Svg File Before Rasterize : STOP
		
		if ( isset( $wgSVGConverters[$wgSVGConverter] ) ) {
			$cmd = str_replace(
				array( '$path/', '$width', '$height', '$input', '$output' ),
				array( $wgSVGConverterPath ? wfEscapeShellArg( "$wgSVGConverterPath/" ) : "",
					   intval( $width ),
					   intval( $height ),
					   wfEscapeShellArg( $srcPath ),
					   wfEscapeShellArg( $dstPath ) ),
				$wgSVGConverters[$wgSVGConverter]
			) . " 2>&1";
			wfProfileIn( 'rsvg' );
			wfDebug( __METHOD__.": $cmd\n" );
			$err = wfShellExec( $cmd, $retval );
			wfProfileOut( 'rsvg' );
		}
		
		// Nux: Asciify Svg File Before Rasterize : START
		if ( $asciifiedSvgFile ) {
			// copy dst file to the rightfull folder/name
			if ( !copy( $dstPath, $dstPathTmp ) ) {
				wfDebug( __METHOD__.": failed to copy dst: $dstPath to $dstPathTmp\n" );
			}
			// change paths back to original
			$srcPath = $srcPathTmp;
			$dstPath = $dstPathTmp;
		}
		// Nux: Asciify Svg File Before Rasterize : STOP
		
		$removed = $this->removeBadFile( $dstPath, $retval );
		if ( $retval != 0 || $removed ) {
			wfDebugLog( 'thumbnail', sprintf( 'thumbnail failed on %s: error %d "%s" from "%s"',
					wfHostname(), $retval, trim($err), $cmd ) );
			return new MediaTransformError( 'thumbnail_error', $width, $height, $err );
		}
		return true;
	}

Note that I use MW 1.16.0. You should change this code if you other version. Note that the added code is in globals and in between // Nux: Asciify Svg File Before Rasterize.

Cheers, Nux 16:22, 7 November 2011 (UTC).Reply

Batik does not handle with long css sections[edit]

This took me a while to figure out: Batik will only parse the first hundred or so css rules, and then finish the rendering with no error message. I finally had to switch to ImageMagic to make everything work. rotsee 10:10, 11 November 2011 (UTC)Reply

opensuse + rsvg[edit]

MediaWiki 1.17 and 1.18 on openSUSE 11.4 with rsvg 2.32.1

Encoding problem with non-ASCII svg file names.

this worked with params:

$wgSVGConverters = array( 'rsvg' => 'rsvg-convert -w $width -h $height $input > $output');
$wgSVGConverter = 'rsvg';

but not worked with:

$wgSVGConverters = array( 'rsvg' => 'rsvg-convert -w $width -h $height $input -o $output');
and
$wgSVGConverters = array( 'rsvg' => 'rsvg -w $width -h $height $input $output');

also work fine in terminal:

> rsvg-convert -w 200 -h 60 проба.png -o проба.svg
> rsvg -w 200 -h 60 -o проба.svg проба.png

--Pastakhov 09:34, 9 January 2012 (UTC)Reply

How to change default image upload description? (question)[edit]

How to "properly" change default file description that shows before you upload image (like on wikipedia.org) - for few wikimedia releases I've been doing it by changing includes/specials/SpecialUpload.php

--- SpecialUpload.php-norig	2010-08-01 13:25:19.633372106 +0200
+++ SpecialUpload.php	2010-08-01 13:27:01.008372116 +0200
@@ -884,6 +884,7 @@
 				'label-message' => $this->mForReUpload
 					? 'filereuploadsummary'
 					: 'fileuploadsummary',
+				'default' => almanach_return_empty_file_description(),
 				'cols' => $cols,
 				'rows' => 8,
 			)

And adding almanach_return_empty_file_description() to LocalSettings.php with desired return value, but this requires changed on every update - is there more "proper" way to do it? Sauron (talk) 08:22, 19 February 2012 (UTC)Reply

Metadata preservation[edit]

Where do we adjust the settings for preserving embedded metadata in resized and thumbnailed images?

Currently on my installation, if I upload a .jpg image file that's been carefully stuffed with metadata, so that it's optimised for image search engines and for reuse outside MediaWiki, that data is preserved in the original uploaded file, but it's stripped from all the smaller versions of the file that MediaWiki generates for display (including the mid-sized preview image). I don't care much either way if thumbnails are stripped, but I want critical embedded information - keywords, descriptions, titles, locations, author, licensing, copyright info, etc. - to be retained.

Presumably there's going to be some function or setting somewhere for "preserve metadata when thumbnailing" ? ErkDemon (talk) 11:10, 10 September 2012 (UTC)Reply

After updating to WM1.19.1, most of thumbnails are not displayed anymore. There is only a message that the file could not be saved. Magick is off, /images and subdirectories are present and writeable. Any help is welcome!

Thorsten (talk) 07:52, 13 September 2012 (UTC)Reply

How to show the SVG itself - disable PNG conversion - and leave display to browsers supporting SVG?[edit]

I want to upload an SVG file to my Mediawiki and leave display to the browser - I do not want Mediawiki to convert anything, just define viewing size in the article page. Is this possible? How do I disable thumbnail creation - I don't need it - really. It is important for exporting article with SVG illustrations as EPUB 3.

+1 The manual page here says: "Set $wgSVGConverter = false if SVG rendering is not needed and you wish to make your users download the svg file in order to view it." Why would I want to offer my users a link to download an SVG file? If they came with a browser which supports SVG, just show it, if not, then offer a link.

Edit Comment[edit]

When uploading an image I made an error in the Summary text which is then displayed in the Comment box on the image page. I can't find any way of editing that text as it seems to be generated automatically. Does anyone know how I can correct the text.

Sorry peeps, forgot to login before originating this topic Greynose (talk) 20:45, 27 January 2013 (UTC)Reply

Image won't appear only text[edit]

I have a problem on my wiki. Each time when I upload a image, the image won't appear but only the text. I've watched it at Special:NewFiles but the image won't appear as well, as example. Also this is really frustrating me because I have no idea what I did wrong or how it came like that. Also the other issue is right here. Hopefully someone can help me out with this problem, thanks. KidProdigy (talk) 09:16, 1 August 2013 (UTC)Reply

Resized images will not display[edit]

Thumbnails seem to generate okay on http://gridirondigest.info/index.php/File:Indiana_Football_Schools.jpg and full-sized images display okay on pages. But resized images (using the Wiki markup) aren't displaying. See the aforementioned image, resized and not displaying on http://gridirondigest.info/index.php/Main_Page. What could be causing this?
Cmjohannes (talk) 17:30, 15 September 2014 (UTC) SOLUTION: I chmoded the entire /images/ directory recursively making it writable (777).Reply

mbstring[edit]

Hi On redhat 7 upload some images causes error "AH00052: child pid 16887 exit signal Segmentation fault". For me helepd install php-mbstring.

Error in article[edit]

Under the Manual:Image_administration#upload_of_images heading the second link should be to Manual:$wgFileExtensions

Qnnet.pink (talk) 16:42, 24 March 2015 (UTC)Reply

This seems to have been addressed (possibly by removing the offending link). --Ernstkm (talk) 22:14, 23 April 2020 (UTC)Reply

Images like Wikipedia does it[edit]

I'm setting up my own Mediawiki instance and I'm keen to use SVGs in a similar manner as Wikipedia by which I mean default rendering as PNGs and with an option to render at different pixel sizes. Documentation on this seems difficult to find.

I understand how to enable Media Viewer, how to upload SVGs, how to choose a thumbnail renderer but I am struggling with:

  • Allow uploading of SVGs but rendering only as PNGs.
  • Providing the "Size of this PNG preview of this SVG file: 500 × 500 pixels. Other resolutions: 240 × 240 pixels | 480 × 480 pixels | 600 × 600 pixels | 768 × 768 pixels | 1,024 × 1,024 pixels." on the image page.
  • I would also like to be able to put the "Download | Use this file | Email a link | Information header" like Wikimedia commons does it.

This doesn't appear to be covered here and possibly this is the best place for it. Any reference suggestions or links to further information? --Dan.mulholland (talk) 21:27, 16 December 2015 (UTC)Reply

Error creating thumbnail: convert: UnableToAcquireString[edit]

Hi. First of all, my wiki can't create thumbnails for GIF images. Second, one one specific GIF image, I get this error:

Error creating thumbnail: convert: UnableToAcquireString `Cannot allocate memory' @ fatal/string.c/AcquireString/127.
Error code: 1"

What do I do? Here's a link to the site. http://wikizilla.org/wiki/ShinGoji

71.15.112.25 03:05, 12 July 2016 (UTC)Reply
Your server has probably not enough memory (or there's a memory limit imposed on it) to thumbnail a gif image, specially if it's large. This is often the case for animated gif. You would need to manually resize it with an external program and reupload it, if possible, with the same size that will be used on the page. Yo may try to use a different thumbnailer, switching GD to Imagemagick or viceversa. Nice monobook customization BTW. --Ciencia Al Poder (talk) 03:00, 14 July 2016 (UTC)Reply
Lol hola Ciencia Al Poder. Veo que tu contribuiste mucho al skin de WikiDex. Mantení aquel mensaje que dice que originaba desde WikiDex. Me encanta el Monobook skin de ese sitio, y por eso lo copié. Espero que no le moleste eso... (I should really stop speaking Spanish now, shouldn't I?)
Anyways. How would you go about 'switching thumbnailer'? Any way to make it so GIFs play just like on Wikia? Also another question. Is there a way you know to make it so videos can be added to image galleries just like in Wikia? Finally one last question. Do you know of any way to make it so I can have a dropdown menu in the sidebar, like WikiDex has in Monobook? Really, if I get these 3 things done, I'll be set. Gracias~ 71.15.112.25 04:08, 20 July 2016 (UTC)Reply
No me molesta en absoluto. For switching thumbnailer you need to switch $wgUseImageMagick (and have imagemagick/graphicsmagic/etc installed). Videos can't be inside galleries like on wikia, you can probably make embedded videos look like galleries with proper CSS and styling, though. And the dropdown uses scripts from [5] (code comments clarify what it needs)--Ciencia Al Poder (talk) 02:03, 21 July 2016 (UTC)Reply
I cannot get the dropdown menu to work. What am I doing wrong? 71.15.112.25 03:12, 26 July 2016 (UTC)Reply
Okay, after one month of trying to figure it out, it would seem to me that the way the dropdown is configured in WikiDex is somehow simply incompatible with my wiki. I found a variation of this dropdown menu on Kingdom Hearts Wiki (khwiki) and THAT worked. STILL, Ciencia Al Poder, I have one lasting issue. I have enabled ImageMagick, but only smaller GIFs and/or GIFs with less frames/detail actually render thumbnails, and the others just don't render (unless it's completely loaded, like with the image viewer). Do you have any clue on what the cause of this might be? 71.15.112.25 07:49, 19 August 2016 (UTC)Reply
If only small gifs work, that's a symptom that there's something limiting the available resources of the thumbnailer, and those limits are too low for other images. This can be either execution time and/or memory. See Manual:$wgMaxShellTime and Manual:$wgMaxShellMemory. Your host may enforce other limits that MediaWiki won't be able to override, though. --Ciencia Al Poder (talk) 09:52, 21 August 2016 (UTC)Reply

GraphicsMagick[edit]

This page says it's possible to use GraphicsMagick in place of ImageMagick by setting $wgImageMagickConvertCommand = "/usr/bin/gm"; (with gm installed in this location, of course). I have tried this as well as $wgImageMagickConvertCommand = "/usr/bin/gm convert"; to point directly to GM's convert command. Both resulted in the following error message when attempting insert a scaled image into a page:

Error creating thumbnail: /bin/bash: /usr/local/bin/convert: No such file or directory
Error code: 127

This indicates that it's ignoring my attempt to set $wgImageMagickConvertCommand.

The revision to this page where GraphicsMagick was said to be acceptable is here. There is a Phabricator task which indicates that GraphicsMagick may not be supported.

Should the statement about GraphicsMagick be removed from this page?

--Jamesmontalvo3 (talk) 02:01, 2 November 2016 (UTC)Reply

Install Imagemagick[edit]

Hello.
I try to install the imagemagick software. where I need to lacal it? wich directory? Thanks.
Betmidrash (talk) 14:23, 4 May 2017 (UTC)Reply


ImageMagick Use/install On UBUNTU 16.04[edit]

When you have permission denied error the problem could be installation of Imagemagick then you can try : sudo /usr/local/bin/convert -version

How to Install the package in ubuntu 16.04[edit]

cd yourdirectory
sudo wget https://www.imagemagick.org/download/ImageMagick.tar.gz
tar xf ImageMagick.tar.gz
cd ImageMagick-7.0.8-10/
sudo ./configure
sudo make
sudo make install
sudo make check
sudo ldconfig /usr/local/lib
sudo identify -version
sudo /usr/local/bin/convert -version

Check in LocalSettings.php the rows below and their settings:

$wgEnableUploads  = true;
$wgUseImageMagick = true;
$wgUseImageResize = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";
$wgMaxShellMemory = 524288;
$wgUseInstantCommons  = false;

If ImageMagick is installed try the following command analize the output /usr/bin/local/convert -version, the output must be like: "Version imageMagick....bla bla"
How Troubleshooting: Go to the working directory of ImageMagick, open with vi config.log and good look!

Massimiliano Sessa


Thumbnail doesn't display, no error message in the logs[edit]

Thumbnails aren't displayed because of the attribute srcset added to the <img> tag has a wrong source (problem of parsing).

You can solve it with two different ways: - Add this line on your LocalSettings.php to stop using the responsive image functionality : $wgResponsiveImages= false; (or change it from true to false). - Change this line in your LocalSettings.php to restore the responsive image functionality : $wgShellLocale = "C.UTF-8"; Verify from the source before changing this line please.

Old images on old pages[edit]

If I look at at an old revision of a page, why do I see the images as they appear today? Shouldn't I see the images as they appeared on that revision's date? Is there a setting within MediaWiki that allows a specific installation to have the readers of old revisions be shown the contemporary images, and not the most recent images? Jrkenti (talk) 00:43, 3 May 2022 (UTC)Reply

Is it safe to delete the contents of the temp image directory?[edit]

Per the documentation, files in the images/temp directory may not get cleaned up. Is it safe to manually clean that out every so often, like with a find command and restricting to, for example, files more than 30 days old? Justin C Lloyd (talk) 23:11, 9 May 2023 (UTC)Reply

Upload stash files are kept there, so if you delete them while someone's uploading the upload would fail. But you're right, if you limit it to old ones I think it'd be okay. (Not 100% sure though!) Sam Wilson 06:08, 10 May 2023 (UTC)Reply