1

After enabling the latest Mosaico on one site, we found the icons are not loaded after adding a new template. After dragging the image from the left to place on the template the image is displayed as below -

enter image description here

On opening the ajax url in a new window, it says -

The Image <258*150_url> cannot be displayed because it contains errors`

2

After looking for a while, I found this was due to the whitespace before <?php i.e

<space><?php (starting of the file)

in civicrm_settings.php file which was messing the png file generation. On removing this space, the image was loaded correctly without errors. So if anyone encounters this error, make sure all your included files are white-space free before <?php.

Update: This normally occurs due to an invalid image that is formed by the headers. Flushing the headers with ob_clean() just before specifying the same have also worked for some users. There is a great answer https://stackoverflow.com/a/2591854/4243217 which explains about the space issue while creating image using ImagickDraw(used by Mosaico).

  • Jintendra - thanks for this diagnosis. I am facing exactly the same issue and do not have a whitespace before <?php in my civicrm.settings.php file. A search in the directory tree uncovers many files that have such whitespaces before <?php, including WordPress theme files, plugins, civicrm extensions, etc. Can you explain why such a whitespace is an issue for this pop-up, and how to mitigate it? Which files are loaded by Imagick when generating the image? Thanks. – Nicolas at cividesk Oct 6 '17 at 0:06
  • For further reference - there was a ?>\n\n<?php in the functions.php file of the WordPress Church theme. Removed it and it fixed the issue. I believe this issue would be corrected by resolving github.com/veda-consulting/uk.co.vedaconsulting.mosaico/issues/… – Nicolas at cividesk Oct 6 '17 at 5:38
  • will soon update the answer of why it is actually needed. – jitendra - fuzion Oct 6 '17 at 6:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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