Answers.Body: <p>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!</p>
  
  <p>In my case, it was due to a dodgy Drupal module that was injecting whitespace into all the images which caused them to break.</p>
  
  <p>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.</p>
  
  <p>There was two new lines before the opening PHP tag <code>&lt;?php</code> and once I had removed this, Mosaico worked as it should normally.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-03T00:31:27.200Z
Answers.Text: What was the Drupal module that was causing this? I'm having similar issues.
Answers.UserDisplayName: josh
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-03T08:37:03.697Z
Answers.Text: 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
Answers.UserDisplayName: Jade
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-01T08:06:54.843Z
Answers.LastActivityDate: 2019-07-01T08:06:54.843Z
Answers.UserDisplayName: Jade
Answers.Body: <p>I've just had a seemingly identical problem on upgrade to 5.13.5 (ImageMagick reported as missing when present &amp; up to date).</p>
  
  <p>Disabling Mosaico/Fleximailer/Shoreditch &amp; then re-enabling them seemed to resolve the issue.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-03T05:35:06.053Z
Answers.Text: It's not just 5.13, I had the same issue with 5.11. Disable and Re-enable also fixed it for me.
Answers.UserDisplayName: tanbog
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-03T07:54:47.097Z
Answers.Text: Hi Bryan, I've tried what you suggested but I still can't upload images! What a nightmare!
Answers.UserDisplayName: Jade
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-03T07:59:43.107Z
Answers.Text: Same here on 5.7. Bryan's fix worked for me.
Answers.UserDisplayName: user7166
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-04T00:53:43.710Z
Answers.Text: 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.
Answers.UserDisplayName: Bryan
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-04T09:57:38.757Z
Answers.Text: 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
Answers.UserDisplayName: Jade
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-19T07:43:52.683Z
Answers.Text: Same problem started for me upon updating Mosaico extension from 2.0 to 2.1, `Failed to locate Mosaico graphics driver. Either "mosaico_graphics" is invalid...` as above. I have had Mosaico 2.0 installed for a while but disabled. Today on enabling Mosaico 2.0, no error. Got the error on upgrading to 2.1. Also the form fields on the Mosaico Settings page were all missing.
  I disabled Mosaico extension and re-enabled and error is now gone and Mosaico Settings work properly. Note as I haven't been using the extension I can't say everything works.
  This was on CiviCRM 5.14.1 and Joomla 3.9.8.
Answers.UserDisplayName: Andrew Thompson
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-06-01T03:01:26.193Z
Answers.LastActivityDate: 2019-06-01T03:01:26.193Z
Answers.UserDisplayName: Bryan
Answers.Body: <p>If it has been working correctly and then produces this error, clearing the cache is sometimes enough to get it working again: <code>Administer &gt; System Settings &gt; Cleanup Caches and Update Paths</code></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-29T14:48:09.650Z
Answers.Text: Thanks for your addition - I have had to do this a few times when it throws the error randomly
Answers.UserDisplayName: Jade
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-12-06T20:14:03.660Z
Answers.Text: This solved my problem after upgrading the Flexmailer extension caused a "failed to located graphics driver" error. (Joomla, not Drupal)
Answers.UserDisplayName: Phil Morice Brubaker
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-08-29T14:17:26.810Z
Answers.LastActivityDate: 2019-08-29T14:17:26.810Z
Answers.UserDisplayName: Aidan
Answers.Body: <p>Most likely it's missing PHP's ImageMagick OR GD Extension, required for image manipulation.</p>
  
  <p>One quick way to check phpinfo in drupal is to visit url <a href="https://example.org/admin/reports/status/php" rel="nofollow noreferrer">https://example.org/admin/reports/status/php</a> and see if you find imagemagick or GD related info.</p>
  
  <p><a href="https://i.sstatic.net/PzQ3g.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/PzQ3g.png" alt="enter image description here"></a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-31T14:06:10.420Z
Answers.Text: Deepak, thank you for your suggestion but I do have ImageMagick installed on the server, you can see here - https://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?
Answers.UserDisplayName: Jade
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-31T14:11:44.877Z
Answers.Text: 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.
Answers.UserDisplayName: Deepak Srivastava
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-31T14:20:20.100Z
Answers.Text: Other way be to debug along the lines of https://github.com/veda-consulting/uk.co.vedaconsulting.mosaico/blob/2.x/CRM/Mosaico/Services.php#L66 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.
Answers.UserDisplayName: Deepak Srivastava
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-31T14:29:39.980Z
Answers.Text: 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
Answers.UserDisplayName: Jade
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-05-31T13:08:13.460Z
Answers.LastActivityDate: 2019-05-31T13:08:13.460Z
Answers.UserDisplayName: Deepak Srivastava
Answers.Body: <p>I know this is old but I wanted to add another answer to hopefully help others in the future.</p>
  
  <p>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.</p>
  
  <p>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.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-09-10T16:17:14.777Z
Answers.LastActivityDate: 2019-09-10T16:17:14.777Z
Answers.UserDisplayName: Jade
Body: <p>I'm using Drupal 7 and CiviCRM version 5.13.4 and I'm having a problem with using Mosaico. </p>
  
  <p>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.</p>
  
  <p>When I try to do so, I get a 500 Error in the console. </p>
  
  <pre><code> GET https://site.com/civicrm/mosaico/img?method=placeholder&amp;params=300%2C200 500 (Internal Server Error)
  </code></pre>
  
  <p>I also get this error in the top right of the screen:</p>
  
  <pre><code>Failed to locate Mosaico graphics driver. Either "mosaico_graphics" is invalid or the autodetection failed.
  </code></pre>
  
  <p>I attempted a google on that error but it appears it's never been reported before which isn't very helpful to me. </p>
  
  <p>Below is a screenshot on how the templates look to me if it's of any use:</p>
  
  <p><a href="https://i.sstatic.net/HXaDf.png" rel="noreferrer"><img src="https://i.sstatic.net/HXaDf.png" alt="enter image description here"></a></p>
  
  <p>Happy to answer any follow up questions! Thanks in advance.</p>
  
Tags: <drupal><civimail><mosaico>
Title: Failed to locate Mosaico graphics driver
ThreadText: # Failed to locate Mosaico graphics driver
  
  (Asked by: username_0 on 2019-05-31)
  
  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:
  
  Happy to answer any follow up questions! Thanks in advance.
  
  **Tags:** drupal, civimail, mosaico
  
  
  ---
  
  ## 5 answers
  
  ### Answer by username_0 on 2019-07-01. Score: 3 | Accepted answer
  
  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</code and once I had removed this, Mosaico worked as it should normally.`
  
  > **Comments:**
  > **username_1**: What was the Drupal module that was causing this? I'm having similar issues.  
  > **username_0**: 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  
  
  ---
  
  ### Answer by username_2 on 2019-06-01. Score: 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.
  
  > **Comments:**
  > **username_3**: It's not just 5.13, I had the same issue with 5.11. Disable and Re-enable also fixed it for me.  
  > **username_0**: Hi username_2, I've tried what you suggested but I still can't upload images! What a nightmare!  
  > **username_4**: Same here on 5.7. username_2's fix worked for me.  
  > **username_2**: 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.  
  > **username_0**: Hi username_2, 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  
  > **username_5**: Same problem started for me upon updating Mosaico extension from 2.0 to 2.1, `Failed to locate Mosaico graphics driver. Either "mosaico_graphics" is invalid...` as above. I have had Mosaico 2.0 installed for a while but disabled. Today on enabling Mosaico 2.0, no error. Got the error on upgrading to 2.1. Also the form fields on the Mosaico Settings page were all missing. I disabled Mosaico extension and re-enabled and error is now gone and Mosaico Settings work properly. Note as I haven't been using the extension I can't say everything works. This was on CiviCRM 5.14.1 and Joomla 3.9.8.  
  
  ---
  
  ### Answer by username_6 on 2019-08-29. Score: 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`
  
  > **Comments:**
  > **username_0**: Thanks for your addition - I have had to do this a few times when it throws the error randomly  
  > **username_7**: This solved my problem after upgrading the Flexmailer extension caused a "failed to located graphics driver" error. (Joomla, not Drupal)  
  
  ---
  
  ### Answer by username_8 on 2019-05-31. Score: 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](https://i.sstatic.net/PzQ3g.png)](https://i.sstatic.net/PzQ3g.png)
  
  > **Comments:**
  > **username_0**: Deepak, thank you for your suggestion but I do have ImageMagick installed on the server, you can see here - https://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?  
  > **username_8**: 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.  
  > **username_8**: Other way be to debug along the lines of https://github.com/veda-consulting/uk.co.vedaconsulting.mosaico/blob/2.x/CRM/Mosaico/Services.php#L66 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.  
  > **username_0**: 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  
  
  ---
  
  ### Answer by username_0 on 2019-09-10. Score: 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.
  
  
  ---
  
  