6

I'm using Drupal 7 and CiviCRM version 5.13.4 and I'm having a problem with using Mosaico.

When I try to create new templates, I'm unable to add new images to them. I can't drag and drop any images or add them using the little upload icon.

When I try to do so, I get a 500 Error in the console.

 GET https://site.com/civicrm/mosaico/img?method=placeholder&params=300%2C200 500 (Internal Server Error)

I also get this error in the top right of the screen:

Failed to locate Mosaico graphics driver. Either "mosaico_graphics" is invalid or the autodetection failed.

I attempted a google on that error but it appears it's never been reported before which isn't very helpful to me.

Below is a screenshot on how the templates look to me if it's of any use:

enter image description here

Happy to answer any follow up questions! Thanks in advance.

5 Answers 5

8

I've just had a seemingly identical problem on upgrade to 5.13.5 (ImageMagick reported as missing when present & up to date).

Disabling Mosaico/Fleximailer/Shoreditch & then re-enabling them seemed to resolve the issue.

6
  • It's not just 5.13, I had the same issue with 5.11. Disable and Re-enable also fixed it for me.
    – tanbog
    Commented Jun 3, 2019 at 5:35
  • Hi Bryan, I've tried what you suggested but I still can't upload images! What a nightmare!
    – Jade
    Commented Jun 3, 2019 at 7:54
  • Same here on 5.7. Bryan's fix worked for me.
    – user7166
    Commented Jun 3, 2019 at 7:59
  • I've not had any problem with images. My paths & directories are default settings for this drupal install. I have had such problems on other sites when using custom settings or if the ownership of files or direcories need resetting to the web server user/group after an upgrade.
    – Bryan
    Commented Jun 4, 2019 at 0:53
  • Hi Bryan, everything is the default settings for us too. The site is relatively new, recently changed the domain name so perhaps that is causing an issue somewhere although I wouldn't know where to look
    – Jade
    Commented Jun 4, 2019 at 9:57
6

If it has been working correctly and then produces this error, clearing the cache is sometimes enough to get it working again: Administer > System Settings > Cleanup Caches and Update Paths

2
  • Thanks for your addition - I have had to do this a few times when it throws the error randomly
    – Jade
    Commented Aug 29, 2019 at 14:48
  • This solved my problem after upgrading the Flexmailer extension caused a "failed to located graphics driver" error. (Joomla, not Drupal) Commented Dec 6, 2019 at 20:14
3

Most likely it's missing PHP's ImageMagick OR GD Extension, required for image manipulation.

One quick way to check phpinfo in drupal is to visit url https://example.org/admin/reports/status/php and see if you find imagemagick or GD related info.

enter image description here

4
  • Deepak, thank you for your suggestion but I do have ImageMagick installed on the server, you can see here - gyazo.com/498f5889bb086fbae27fb7f73dc226d6 Is there another possible cause of why images aren't able to be placed, is there some configuration that needs to be done perhaps?
    – Jade
    Commented May 31, 2019 at 14:06
  • In that case php 500 error log should reveal the exact problem is. Could you check what it's complaining about. Drupal error reporting logs should also work. Commented May 31, 2019 at 14:11
  • Other way be to debug along the lines of github.com/veda-consulting/uk.co.vedaconsulting.mosaico/blob/… and see why Imagick class isn't being loaded. Also if you search of PHP Imagick not being detected, you 'll find more help on steps to take. Commented May 31, 2019 at 14:20
  • Could you tell me where the error log is please? I've scanned a few but haven't found anything as of yet. I turned on error logging in Drupal and got a few errors that I'll update my question with
    – Jade
    Commented May 31, 2019 at 14:29
3

In my case, neither of the other answers solved the issue I was having although I'm sure they are also reasons why Mosaico might not be working!

In my case, it was due to a dodgy Drupal module that was injecting whitespace into all the images which caused them to break.

I set up a local copy of the site and enabled each module one by one until the images broke and then when I found the module it broke at, it wasn't hard for me to find the rogue PHP file.

There was two new lines before the opening PHP tag <?php and once I had removed this, Mosaico worked as it should normally.

2
  • What was the Drupal module that was causing this? I'm having similar issues.
    – josh
    Commented Jul 3, 2019 at 0:31
  • It was one of the Gavias theme modules - Gavias shortcode. It could happen with any module though really which is annoying! It could also be the theme
    – Jade
    Commented Jul 3, 2019 at 8:37
3

I know this is old but I wanted to add another answer to hopefully help others in the future.

ImageMagick has to be installed on the PHP version that the site runs on; if it is installed on 5.x and your site runs on 7.x, it won't pick up the package. This might seem obvious but I feel things like this are often overlooked.

Additionally, if you have it installed on the right version of PHP but it still isn't working and you can't see it on the PHP info page, restarting PHP on the server will allow it to pick up any new packages that have been installed. Another simple but easily overlooked solution.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.