Topic on Project:Support desk

Jump to: navigation, search

image resize thumbnails on synology diskstation

Dafrk (talkcontribs)

When I want to include a image as a thumbnail, I get the message that there was an error trying to create it (with nothing more info inside), no matter if I am trying to resize jpg or png. Ok, so I did a lot of research to make sure that I read the fine manual before I ask you.

I assured the following:

  • imagemagick is installed in /volume1/@optware/bin/, there is the 'convert' file
  • I made links with ln -s to this directory in /opt/bin/convert, (usr/bin/convert, /bin/convert
  • I even did chmod 777 on /opt/bin/convert so I assured it doesn't lie on the file rights
  • I entered the following options in my LocalSettings.php:
  • I made /mediawiki/images/temp and /mediawiki/uploads and I chmodded it to 777 to again be sure that it's not the file permissions
$wgEnableUploads = true;
$wgUseImageResize = true;
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = "/usr/bin/convert";
$wgUploadSizeWarnng = 1024*1024*100;
$wgMaxUploadSize = 1024*1024*100;
$wgFileExtensions = array('png','gif','jpg','jpeg','doc','xls','xml','pdf','tiff','docx','xlsx','ps','odt','tar','gz','rar','zip','7z','ods','odp','odg');
$wgUploadPath = "$wgScriptPath/uploads";
$wgUploadDirectory = "$IP/uploads";
$wgTmpDirectory = "$IP/images/temp";

I installed libpng, libjpeg and openjpeg via Apache IPKG

I tested the convert-file on the shell and I can convert pics with convert image.jpg -resize

the uploaded images are in /mediawiki/uploads in some random subfolders like '2' or 'd'. They are about 30-50 KB.

I also checked my php.ini if there is set 'disable̠function' but the string is empty, so exec()-function in PHP should work. in the folder /mediawiki/uploads, where the images are, there is no .htaccess-file yet Here are the folder's options of my httpd.conf

<Directory "/volume1/web/mediawiki/images">
#Ignore .htaccess files
AllowOverride None
#Serve HTML as plaintext, don't execute SHTML
AddType text/plain .html .htm .shtml .php .cgi .js .pl .java .rb .rbw
#Don't run arbitrary PHP code.
php_admin_flag engine off
Options -Indexes
<Directory "/volume1/web/mediawiki/uploads">
#Ignore .htaccess files
AllowOverride None
#Serve HTML as plaintext, don't execute SHTML
AddType text/plain .html .htm .shtml .php .cgi .js .pl .java .rb .rbw
#Don't run arbitrary PHP code.
php_admin_flag engine off
Options -Indexes

What else would I possibly have to check? Is there anything I should check in my httpd.conf? TIA (talkcontribs)


You pretty much went through the whole chain and tested everything. One thing you might try is to see, which command exactly MediaWiki is sending to convert (which then fails) and to send exactly the same command via the shell.

Bawolff (talkcontribs)

See manual:How to debug for info on how to enable debug logging, which may give more information, and will also tell you the exact command executed by MediaWiki. Also please include the exact error messages outputted by MediaWiki.

Dafrk (talkcontribs)

thanks guys, i checked by turning on those options in LocalSettings.php

$wgShowExceptionDetails = true;
$wgDebugToolbar = true;
$wgShowDebug = true;
$gwDevelopmentWarnings = true;
$wgShowSQLErrors = true;
$wgDebugDumpSql  = true;
$wgShowDBErrorBacktrace = true;

alright, so I loaded an article with a thumbnail on it and on the thumbnail it says:

ehler beim Erstellen des Vorschaubildes: 
Warning: passthru(): PHP exec disable. in /volume1/web/mediawiki/includes/GlobalFunctions.php on line 2854

which wonders me, so I checked if there is a) safe_mode=off and b) there is no disable_function set

I also tested these PHP scripts:

if(function_exists('exec')) {
    echo "exec is enabled";


if( ini_get('safe_mode') ){ 
  echo "safe mode is on"; 
   echo "safe mode is off";

I put them in the mediawiki main directory where the index.php is and ran them. They output "exec is enabled" and "safe mode is off".

So how could exec still be disabled?

I also set up a log file with $wgDebugFile and when i search convert it says this line:

BitmapHandler::transformImageMagick: running ImageMagick: '/usr/bin/convert' -quality 95 -background white  '/volume1/web/mediawiki/uploads/d/de/Firemans_carry.png'  -thumbnail '100x63!' -set comment 'File source: http://mydomain/mediawiki/index.php/Datei:Firemans_carry.png' -depth 8   -rotate -0   '/volume1/web/mediawiki/uploads/temp/transform_7b7f803965ea-1.png' 2>&1

when I copy the line and get it running on the shell beginnine with /usr/bin/convert, it works. in the temp directory there is a nice small .png file which I can open

when i search Next, I am getting this line

wfShellExec: /bin/bash '/volume1/web/mediawiki/includes/' 'OMP_NUM_THREADS='\1'\ '\/usr/bin/convert'\ -quality 95 -background white  '\/volume1/web/mediawiki/uploads/d/de/Firemans_carry.png'\  -thumbnail '\100x63!'\ -set comment '\File source: mydomain/mediawiki/index.php/Datei:Firemans_carry.png'\ -depth 8   -rotate -0   '\/volume1/web/mediawiki/uploads/temp/transform_7b7f803965ea-1.png'\ 2>&1' 'MW_CPU_LIMIT=180; MW_CGROUP='\'\; MW_MEM_LIMIT=409600; MW_FILE_SIZE_LIMIT=102400; MW_WALL_CLOCK_LIMIT=180'

ok, first thing I tried was to try this line on the shell as well and see - it says /bin/bash - file does not exist. Since Synology Diskstation is using Apache IPKG as Package Management because it needs special installation packages made for it's marvell ARM processor, it is installing new packages in /opt/bin. So I made a link from /opt/bin/bash to /bin/bash and now this line works as well. Seems that from now on this line is gone from my log file, but I still get not thumbnail:

I reloaded the page and now it takes longer to load and before it loads there is a millisecond-long flash like there would be a reallocation of HTML elements but it quits and throws the same error where the thumbnail should be.

I also checked the and it says:


So these might not be the error as well and the Limits are set via command line laters othey would be overwriten as well. But to be srue I increased $wgMaxShellMemory to 809600 just to be sure. then i tried again - still no thumbnail:

now, when i search the filename of the pic, firemans_carry.png, it says this line as well:

Title::getRestrictionTypes: applicable restrictions to [[Firemans Carry]] are {edit,move}

Well i think this is some Mediawiki internate with user management permissions for this image, so I don't think it has anything to do with the problem.

I also find:

File::transform: Doing stat for mwstore://local-backend/local-thumb/d/de/Firemans_carry.png/120px-Firemans_carry.png
FileBackendStore::getFileStat: File mwstore://local-backend/local-thumb/d/de/Firemans_carry.png/120px-Firemans_carry.png does not exist. (talkcontribs)


So the error you see now is

Warning: passthru(): PHP exec disable. in /volume1/web/mediawiki/includes/GlobalFunctions.php on line 2854

Honestly I do not understand, if that should tell you that passthru() is missing or if it is exec(). However, I would try with a file with this content

<?php phpinfo();?>

which, when called with the browser, will show you amongst other things, which functions really are disabled. Make sure to enable that/those function(s), which are missing (passthru, exec) and then try again...

Dafrk (talkcontribs)

yeah, as I expected, phpinfo shows no value for disable_function. there is also no open_basedir set and safe mode is off, too.

What I have discovered is, that I do not have a Can this be the reason for my problem? I don't think that is necessary because imagemagick is called via command line and not by the imagick-PHP-Extension.

I tried the following php script:

$exec = exec("convert /volume1/public/double_leg.jpg /volume1/public/double_leg.png", $output, $return);
echo $exec;
echo "<br />----------------<br />";
echo "<br />----------------<br />";

If I run it in the browser from the mediawiki root directory, it doesn't work. If i run it by shell with "php file.php" it works. Seems something's really wrong with exec.

Edit: I am still open for any more suggestions on how to fix the problem, but google research brought me to think that Synology somehow turned off the php exec-function hard-coded. It seems dependant on what Diskstation you have if you can fix this or not. Users using my model (DS107+) are stating that they didn't suceed in getting exec to run. Until I find out anything else, I am using ImageResize without imageMagick for now. (talkcontribs)


I also use the Synology DiskStation to host my MediaWiki. I had also the problems with the image processing (described above). But I was able to fix these issues by updating the version of MediaWiki.

Original (installed) Version 1.19 beta2
Tested (working) Version 1.19.11

Short description:

  • ssh terminal as root
  • rename existing folder /var/services/web/MediaWiki
  • extract new version in /var/services/web
  • change owner und group to nobody
  • create a soft link /var/services/web/MediaWiki for the new folder
  • copy the old image folder and the LocalSettings.php in the new folder
  • change some entries in the LocalSettings.php
 $wgEnableUploads  = true;
 $wgUseImageMagick = true;
 $wgImageMagickConvertCommand = "/usr/syno/bin/convert";
I found on my System the program convert in the folder /usr/syno/bin. To check your system, use the following command:
 type convert
  • Call the update function
 php maintenance/update.php
Reply to "image resize thumbnails on synology diskstation"