Forums / Install & configuration / ez Publish 4.0.1: ImageMagick does not work in ez Publish

ez Publish 4.0.1: ImageMagick does not work in ez Publish

Author Message

Anita H

Monday 15 December 2008 2:33:26 am

Hi All,
after installatin of ez Publish 4.0.1 ImageMagick does not work although it seems to be working on cmd line. The image.ini override looks like below. So as to see images I need to turn off ImageMagick.

Any idea?
Thanks a lot for your help
Anita

<?php /* #?ini charset="utf-8"?

[ImageMagick]
IsEnabled=false
ExecutablePath=/opt/local/bin
Executable=convert

[small]
Filters[]=geometry/scale=100;100

[medium]
Filters[]=geometry/scale=200;200

[large]
Filters[]=geometry/scale=300;300
*/ ?>

Ivo Lukac

Monday 15 December 2008 3:16:22 am

Hello Anita,

Did you check where is imagemagick executable like this:

whereis convert
 

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Anita H

Monday 15 December 2008 5:02:10 am

Hi Ivo,
yes I did with command "which convert":
/opt/local/bin/convert

I also checked that convert is working in terminal/on command line and it does.

Thx
Anita

Ivo Lukac

Monday 15 December 2008 7:05:45 am

Then it is strange.

Look at var/log/error.log is it reporting something suspicious, maybe some problems with apache user rights on filesystem, or something similar

http://www.linkedin.com/in/ivolukac
http://www.netgen.hr/eng/blog
http://twitter.com/ilukac

Arnaud Lafon

Monday 15 December 2008 7:17:10 am

Hi Anita,

did you check that ezpublish is able to write on your var/ directory ?

I also notice "IsEnabled=false" instead of "IsEnabled=true"... If set to false, then ezpublish will try to use gd2.

You can also copy & paste in your command line what appears in the ezpublish debug.

Looking for information about SQLI ?
Looking for a new job in Paris ?
Please contact me at alafon [at] sqli [dot] com

Anita H

Monday 15 December 2008 7:41:16 am

Hi Arnaud,
thanks for your reply. Yes, I checked all read/write access rights on my var/ directory, and yes ImageMagick was/is enabled (sorry, copied the version where I disabled ImageMagick so as to go ahead with something else).

I receive the following error in my logs:

[ Dec 15 2008 14:16:58 ] [::1] eZImageManager::createImageAlias:
Failed converting var/ezwebin_site/storage/images/company/news/lyon-puts-europe-at-your-doorstep/913-1-eng-GB/Lyon-puts-Europe-at-your-doorstep.jpg to alias 'articlethumbnail' in directory 'var/ezwebin_site/storage/images/company/news/lyon-puts-europe-at-your-doorstep/913-1-eng-GB'

I checked the other Forum entries, tried different path settings in override image ini, but nothing seems to work.

Any other idea? Thanks for your help
Anita

Anders Berre

Tuesday 16 December 2008 12:11:09 am

Have you tried to run a convert line in shell, just to see that convert really works?

In that way I guess you'll find out if you have permission to run convert and if the converte execute as it should.

Some easy examples can be find here:
http://www.imagemagick.org/script/convert.php

Sincerely,

Anders Sandvik Berre
http://www.netmaking.no/

Arnaud Lafon

Wednesday 17 December 2008 12:34:37 am

Anita,

Afaik you should have the complete convert shell command just after the log you gave us. Running this command at the root of your ezpublish installation will give you more information.

Looking for information about SQLI ?
Looking for a new job in Paris ?
Please contact me at alafon [at] sqli [dot] com

Tero Auralinna

Sunday 25 January 2009 11:16:19 pm

Check your php.ini configuration. I had similar problem and reason was that system function was disabled.

NXC Finland - Open Source solutions, Internet marketing and web analytics
http://www.nxc.fi
http://www.auralinna.fi
http://twitter.com/teroauralinna

Anita H

Monday 26 January 2009 12:16:37 am

Hi Tero,
that was a good hint. Thanks a lot, it works now. What I did:

in image.ini:
as I'm working on Mac I made sure that the executable name line for Mac was enabled:
# Name of the executable
# Executable=convert
# Name of the executable for windows,
# uncomment ExecutableMac for Mac specific converter and
# ExecutableUnix for Unix/Linux specific converter
ExecutableMac=convert

in php.ini:
I added the following line, although safe mode was off:
; When safe_mode is on, only executables located in the safe_mode_exec_dir
; will be allowed to be executed via the exec family of functions.
safe_mode_exec_dir =/opt/local/bin/

wherby /opt/local/bin is the directory where ImageMagick is installed.
And now it works.

Thanks a lot. Highly appreciated your help.
Cheers
Anita

Luigi Spagnolo

Monday 23 February 2009 5:04:12 am

I have problems with ImageMagick too: ezPublish doesn't show the images, as you can see from the pages below.

http://www.fclombardia.it/alfc/index.php?/ita/Mediateca/Galleria-di-prova/Image-with-ImageMagik
http://www.fclombardia.it/alfc/index.php?/ita/Mediateca/Galleria-di-prova (latest image: the other ones have been displayed using gd)

The settings/override/image.ini.append.php contains the following lines:

<?php /* #?ini charset="utf-8"?

[ImageMagick]
IsEnabled=true
ExecutablePath=/usr/bin
Executable=convert

*/ ?>

I get the following errors in the ez log:

Warning: PHP Feb 23 2009 13:19:48

Undefined variable: returnCode in /web/htdocs/www.fclombardia.it/home/alfc/lib/ezimage/classes/ezimageshellhandler.php on line 127

Warning: PHP Feb 23 2009 13:19:48

system() has been disabled for security reasons in /web/htdocs/www.fclombardia.it/home/alfc/lib/ezimage/classes/ezimageshellhandler.php on line 127

Warning: PHP Feb 23 2009 13:19:48

Undefined variable: returnCode in /web/htdocs/www.fclombardia.it/home/alfc/lib/ezimage/classes/ezimageshellhandler.php on line 129

Error: eZImageShellHandler(ImageMagick) Feb 23 2009 12:47:33

Unknown destination file: var/ezwebin_site/storage/images/mediateca/galleria-di-prova/image-with-imagemagik/1852-1-ita-IT/Image-with-ImageMagik_imagelarge.jpg when executing '/usr/bin/convert '-quality' '75' '-geometry' '550x730>' 'var/ezwebin_site/storage/images/mediateca/galleria-di-prova/image-with-imagemagik/1852-1-ita-IT/Image-with-ImageMagik.jpg' 'JPEG:var/ezwebin_site/storage/images/mediateca/galleria-di-prova/image-with-imagemagik/1852-1-ita-IT/Image-with-ImageMagik_imagelarge.jpg''

Error: eZImageManager::createImageAlias Feb 23 2009 12:47:33

Failed converting var/ezwebin_site/storage/images/mediateca/galleria-di-prova/image-with-imagemagik/1852-1-ita-IT/Image-with-ImageMagik.jpg to alias 'imagelarge' in directory 'var/ezwebin_site/storage/images/mediateca/galleria-di-prova/image-with-imagemagik/1852-1-ita-IT

'From the phpinfo() i see that system function is disabled.for my hosting, is there a chance to run ImageMagick i ezPublish with system disabled?

Luigi Spagnolo

Monday 23 February 2009 6:39:11 am

SOLVED with this workaround in lib/ezimage/classes/ezimageshellhandler.php

changed

<i>system( $systemString, $returnCode );

if ( $returnCode == 0 )
{
if ( !file_exists( $destinationMimeData['url'] ) )
{
eZDebug::writeError( 'Unknown destination file: ' . $destinationMimeData['url'] . " when executing '$systemString'", 'eZImageShellHandler(' . $this->HandlerName . ')' );
return false;
}
$this->changeFilePermissions( $destinationMimeData['url'] );
return true;
}
else
{
eZDebug::writeWarning( "Failed executing: $systemString, Error code: $returnCode", 'eZImageShellHandler::convert' );
return false;
}</i>

with the following code

<i>exec( $systemString, $returnCode );

if ( $returnCode == 0 || $returnCode == null || count($returnCode)==0)
{
if ( !file_exists( $destinationMimeData['url'] ) )
{
eZDebug::writeError( 'Unknown destination file: ' . $destinationMimeData['url'] . " when executing '$systemString'", 'eZImageShellHandler(' . $this->HandlerName . ')' );
return false;
}
$this->changeFilePermissions( $destinationMimeData['url'] );
return true;
}
else
{
$returnCodeStr = implode( ' ', $returnCode);
eZDebug::writeWarning( "Failed executing: $systemString, Error code: $returnCodeStr", 'eZImageShellHandler::convert' );
return false;
}</i>