ImageMagick is not generating images

Hi all,

Sorry to rehash a well covered subject but I am stumped. I cannot for the life of me get ImageMagick to create dynamic images from my templates, into the thumbs folder. I am on a shared Linux hosting package.

I have tried all ways of enabling IM as the thumbs driver, without success. I have searched this forum for answers; all pointing to the 2 simple methods of setting the driver, and setting the path to convert in the Kirby config file.

I have done this, checked the path to /usr/local/bin/convert and it seems correct for my hosting setup (this is where the Magick-config files are). Convert is an executable file (777), and the thumbs folder is set to 755, but still nothing works.

I must point out: the thumbs folder and image generation work just fine when using the default GD Lib setting, but I am not happy with the quality of the images.

As soon as I try c::set('thumbs.driver', 'im'); in the config, with or without c::set('thumbs.bin', '/usr/local/bin/convertā€™);, nothing is generated in the thumbs folder and my page source code shows only the original image url is being used for all responsive sizes.

Any ideas what may be going wrong here?! This is proving to be a real pain to get working, I have already had numerous messages with tech support at the hosting co, who are more clueless than I am!

One thing I just noticed: the IM phpinfo version and actual installed version do not match. Could this be the issue?!

In my phpinfo file, the imagick compiled library version says 6.9.2-5 (2015-11-09), while the Magick-config files and installed version at /usr/local/lib are 6.5.1-9 (2011-09-24).

I am on PHP 5.6.22 with Kirby 2.5.8.

Surely this is something simple, but it is frustrating as hellā€¦ Any help, advice or suggestions please?

Cheers.

Does your hosting allow you to upgrade to PHP 7? Is there anything the PHP log files to suggest a problem? Do you get any kind of warnings or errors in the Kirby panel?

Not usually the case on shared hosting, but are you able to SSH and run stuff? Have you tried using image magic from the command line to verify it works?

Itā€™s possible that /usr/local/bin/convert may not be the full path to image magick as far as Kirby is concerned. Try going in via SSH, move into that folder and and type ā€˜pwdā€™ and hit enter. It will print the full path. Verify it matches up.

Thanks for your speedy reply James! Good suggestions, I am not so techy so using terminal and the command line is not my strength.

But I have just tried a few things, getting this message when going to /usr/local/bin/convert at my hosting account via terminal:

bash-3.2$ /usr/local/bin/convert pwd
/usr/local/bin/convert: error while loading shared libraries: libMagickCore.so.2: cannot open shared object file: No such file or directory

Hmm, more confusion!

Trying to check where ImageMagick exists via /usr/local/lib I get:

bash-3.2$ /usr/local/lib pwd    
bash: /usr/local/lib: is a directory

I cannot figure anything out beyond this.

ImageMagick-6.5.1 plus all lib files are inside /usr/local/lib via my SFTP account, so it does seem to be installed. Just things are not connecting up somewhere along the line?

How would I try to run IM via terminal/SSH?

Cheers.

pwd should be run on its own:

bash-3.2$ cd /usr/local/lib
bash: pwd

Did you try setting the Kirby config thumbs.bin to /usr/local/lib/convert? Is there convert executable also at that location?

Try upgrading to PHP7 since this should setup a whole new set of environment paths. PHP 5.6 that you are currently running is a little old. You will also get a performance boost with 7.

trying running convert -h on the command line too. That should tell you if imagemagic is properly installed. If it says something like command not found, then its broken. If you get a bunch of help text then its probably installed ok.

Yes, I tried setting the config to both /usr/bin/convert (755 permissions) and /usr/local/bin/convert (777 permissions) without any success or difference.

Via SFTP I can navigate to both areas and see the convert files are present. Could this be a duplication or is it intended to be in separate areas? I cannot edit or change permissions on these. In /usr/local/bin there are also 4 Magick-config files, not sure if that means this is the path to the correct convert.

This has wrecked my head, having to dig so deep just to get an apparently simple function working. I have asked the host to request someone technical try and resolve this for me; clearly something in their setup is not working as it should. Though I am not convinced theyā€™ll fix it.

Yes, I can install php 7, but the host say IM is not available with it. I tried, and the php.ini Iā€™m using to include the IM module takes no effect at all with php 7. So thatā€™s a no goā€¦

Itā€™s clear this is an issue with your webserver setup. I would advise you to contact your host to help you out with this!

I agree with @bvdputte - With shared hosting this kind of thing should be ready to go, IM is a common enough dependency for a lot of systems. It is worrying that your host is clueless how to fix it.

Forcing you to use much older version of PHP (with much more widely known security issues) because they cant be bothered to install it for 7 is just crazy.

There is a thread on the forum somewhere listing Kirby friendly hosts (tried and tested). Might worth considering moving.

Thanks guys, yes all seems to point to the hosting side not being setup as it should be. Which is a surprise as Iā€™m with TSO in the UK, who have been good over the years.

Though I have noticed a bit of a decline in support proficiency the last couple of years - I think the company ramped up on expansion and hired offshore support etc, whereas back in the day the founders did support so you knew who you were dealing with, and got things sorted fast. Not so these days.

I am still waiting on their response to my request to fix the issues. And as you say - this should be ready to go with PHP 7, let alone older versions so itā€™s got me considering a moveā€¦

Any recommendations for shared Linux hosts, using PHP 7 and IM with a decent/functional control panel?

Yes. I am in the UK as well and totally recommend Krystal (I have a VPS from them).

Fortrabbit also has a good rep.

Small update: how frustrating this has been! Basically, TSO are washing their hands of any responsibility for ImageMagick on their shared servers.

ā€œOur cloud platform does not fully support itā€ is as good a response as Iā€™m getting. A weak excuse to say the least. IM is not a new technology so the fact it breaks on their server is not acceptable.

It seems the extension installs but their server setup/file structure breaks what should be a dead simple module to get working. Wonderful for people who want to utilise the best imaging tool.

I remember trying to set it up on another project a couple of years ago, but gave up thinking it was me doing something wrong.

But I donā€™t like to give up!

Despite this: error while loading shared libraries: libMagickCore.so.2: cannot open shared object file: No such file or directory ā€“ I have an IM test script running which checks if IM is installed and working as a PHP extension and class, then creates an image if they areā€¦ and it works!

But my dynamic thumbnails are nowhere to be seen :cry:

I just canā€™t help thinking itā€™s to do with this whole path to /usr/local/bin/convert and the executable file/s required there. Blah blah, so frustrating I have to dig this deep. A move of host is likely as Iā€™d very much like to switch to IM as the image driver.

Weā€™ll seeā€¦

You basically just convinced me never to go anywhere near TSO for hosting.

If I were you, I would switch to a host that cares.