Hello.
I have issue during generating miniatures on my webpages.
Could You help me with that? :)
File looks fine:
http://westeros.com.pl/Plik:House_Stark.PNG
But miniature not:
Old thread, please create new one
Hello.
I have issue during generating miniatures on my webpages.
Could You help me with that? :)
File looks fine:
http://westeros.com.pl/Plik:House_Stark.PNG
But miniature not:
O
I will look on that.
What option is the best for creating thumbnalis?
SVG
ImageMagick
Batik
rsvg
JPEG
JPEG (using GD)
I have put that code in my LocalSettings.php
#ImageMagic
$wgUseImageMagick = true;
$wgImageMagickConvertCommand = 'C:/ImageMagick/convert.exe'; # for windows
$wgImageMagickConvertCommand = '/usr/local/bin/convert';
Error code 127 is happening in a number of cases. It might help to look into the web server error log. Maybe it contains more information on what is going wrong.
Your line with C:\ImageMagick is superfluous and can be commented out or even removed.
On the shell, please try this command:
/usr/local/bin/convert --version
What does it return?
Another approach would be to enable debbuging in MediaWiki. This can be done as described at Manual:How_to_debug#Logging. Then call a page, on which MediaWiki would show a thumbnail, which does not yet exist. In this case the debug log will contain information on what MediaWiki is doing to create the thumbnail and how it is failing during thumbnail creation.
I run
/usr/local/bin/convert --version
and got:
Version: ImageMagick 6.9.3-2 Q16 x86_64 2016-02-04 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2016 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC OpenMP
Delegates (built-in): bzlib fontconfig freetype jbig jng jpeg lzma png tiff webp x xml zlib
I also put to my LocalSettings.php that code:
/**
* The debug log file must never be publicly accessible because it
* contains private data. But ensure that the directory is writeable by the
* PHP script running within your Web server.
* The filename is with the database name of the wiki.
*/
$wgDebugLogFile = "/var/log/mediawiki/debug-{$wgDBname}.log";
wfErrorLog( "An error occurred.\n", '/var/log/mediawiki/my-custom-debug.log' );
/**
* The debug log file should be not be publicly accessible if it is used, as it
* may contain private data. However, it must be in a directory to which PHP run
* within your web server can write.
*
* Contrary to wgDebugLogFile, it is not necessary to include a wiki-id in these log file names
* if you have multiple wikis. These log entries are prefixed with sufficient information to
* identify the relevant wiki (web server hostname and wiki-id).
*/
// Groups from MediaWiki core
$wgDBerrorLog = '/var/log/mediawiki/dberror.log';
$wgRateLimitLog = '/var/log/mediawiki/ratelimit.log';
$wgDebugLogGroups = array(
'resourceloader' => '/var/log/mediawiki/resourceloader.log',
'exception' => '/var/log/mediawiki/exception.log',
'error' => '/var/log/mediawiki/error.log',
#'exception-json' => '/var/log/mediawiki/exception.json',
// Extra log groups from your extension
#'myextension' => '/var/log/mediawiki/myextension.log',
#'somegroup' => '/var/log/mediawiki/somegroup.log',
);
if ( $module->hasFailed ) {
wfDebugLog( 'myextension', "Something is not right, module {$module->name} failed." );
}
But I don't get any log file.
Be sure PHP can write to /var/log/mediawiki/. Adjust file owner or permissions
search the freaking web? set permissions to 777, trying to explain how to get owner of the process executing php is out of the scope here...
Have you tried to use another path? Ideally one not accessible from the internet
I would say the image processing settings look alright then.
I think you can also get a debug log by setting
$wgDebugToolbar = true;
in LocalSettings.php. Note that the debug log as displayd there contains sensitive information, which a normal visitor should not be getting! Also note that we need the log not from any request, but specially from a request, in which MediaWiki is trying to create a formerly missing thumbnail.
Here is the relevant part from debug log:
File::transform: Doing stat for mwstore://local-backend/local-thumb/5/51/House_Stark.PNG/50px-House_Stark.PNG FileBackendStore::getFileStat: File mwstore://local-backend/local-thumb/5/51/House_Stark.PNG/50px-House_Stark.PNG does not exist. TransformationalImageHandler::doTransform: creating 50x55 thumbnail at /tmp/transform_7bcb7123e0f4.png using scaler im TransformationalImageHandler::doTransform: called wfMkdirParents(/tmp) BitmapHandler::transformImageMagick: running ImageMagick: '/usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x55!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png' wfShellExec: OMP_NUM_THREADS='1' '/usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x55!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png' 2>&1 [exec] Possibly missing executable file: OMP_NUM_THREADS='1' '/usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x55!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png' 2>&1 [thumbnail] thumbnail failed on westeros.com.pl: error 127 "" from "'/usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x55!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png'" [thumbnail] Removing bad 0-byte thumbnail "/tmp/transform_7bcb7123e0f4.png". unlink() succeeded
I would now try running the command from the shell and see, what output it creates.
this command:
OMP_NUM_THREADS='1' '/usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x55!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png'
Hello.
I ran this command and got:
[budrysl2@s53:: ~/domains/westeros.com.pl/public_html ]:$ OMP_NUM_THREADS='1' '/ usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/dom ains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x5 5!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png ';
[budrysl2@s53:: ~/domains/westeros.com.pl/public_html ]:$ OMP_NUM_THREADS='1' '/ usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/dom ains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x5 5!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png '
So nothing happened.
If /tmp/transform_7bcb7123e0f4.png exists then the command succeeded.
Note, however, that you ran this command under a different user than the webserver. You should remove that temp file and try again, this time with the sudo
command, specifying the user account under php runs on your webserver.
For example, if using php-fpm, it may be "sudo -u php-fpm (the entire command)"
> If /tmp/transform_7bcb7123e0f4.png exists...
...and if this file is 'not an empty file with a file size of zero bytes.
And it must have been created with the current execution of the command and not with an earlier one...
I tried to run with sudo:
[budrysl2@s53:: ~/domains/westeros.com.pl/public_html/images/temp ]:$ sudo OMP_NUM_THREADS='1' '/usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x55!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png'
[sudo] password for budrysl2:
Niestety, proszę spróbować ponownie.
[sudo] password for budrysl2:
Niestety użytkownik budrysl2 nie ma uprawnień do uruchamiania '/usr/local/bin/convert -quality 95 -background white /home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG -thumbnail 50x55! -set comment File source: http://westeros.com.pl/Plik:House_Stark.PNG +set Thumb::URI -depth 8 -rotate -0 /tmp/transform_7bcb7123e0f4.png' jako root na s53.linuxpl.com.
I don't have catalog temp.
Temp is only in catalog images. There are many catalogs from 1 to f.
if you don't have a /tmp folder it may be very well the issue here, because it needs to exist and be writeable by the webserver when executing the convert command.
Note that it should be /tmp seen from the filesystem, not /tmp from the webserver root (westeros.com.pl/tmp)!
If the system /tmp folder is somewhere else, you may want to set $wgTmpDirectory to that folder, and/or $wgImageMagickTempDir.
Yes, MediaWiki needs a folder where it can write temporary files before publishing them on the final destination.
OK.
Could I create that folder on my mediawiki and setup Manual:$wgTmpDirectory
I check with my hosting and they tell me that I have /temp and I can use it/
And what about that second setting:
$wgImageMagickConvertCommand = 'C:/ImageMagick/convert.exe'; # for windows
How could I use that one?
Are you using Windows for your MediaWiki installation? If you aren't, then the line is useless or might even be causing fatal errors.
Good. Remove the /tmp/transform_7bcb7123e0f4.png file and run the command again, changing the "www-user" with the user running php (if apache-mod-php, the user running apache, if php-fpm the php-fpm user, etc)
sudo -u www-user OMP_NUM_THREADS='1' '/usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x55!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png'
can't run:
sudo -u php-fpm OMP_NUM_THREADS='1' '/usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x55!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png'
or
sudo -u apache-mod-php OMP_NUM_THREADS='1' '/usr/local/bin/convert' '-quality' '95' '-background' 'white' '/home/budrysl2/domains/westeros.com.pl/public_html/images/5/51/House_Stark.PNG' '-thumbnail' '50x55!' '-set' 'comment' 'File source: http://westeros.com.pl/Plik:House_Stark.PNG' '+set' 'Thumb::URI' '-depth' '8' '-rotate' '-0' '/tmp/transform_7bcb7123e0f4.png'
I get error: Unknown user.