I've setup a global asset field so that a client can change a placeholder image that gets used throughout their website. I'm using the Imager plugin for my image transforms.
The following image code works fine when using a hard-coded image URL:
{% set image = 'http://placehold.it/450x225/eee/eee' %}
{% set transformedImage = craft.imager.transformImage(image, { width: 450, height: 225, }) %}
<img src="{{ transformedImage.url }}" />
But when I replace the hard-coded image URL with the global asset field, it doesn't work:
{% set image = '{{ websitePreferences.placeholderImage.first.url }}' %}
{% set transformedImage = craft.imager.transformImage(image, { width: 450, height: 225, }) %}
<img src="{{ transformedImage.url }}" />
I get this error message (Craft/Exception):
Source folder “/Users/stephen/Repositories/repo-name-here/public_html./” does not exist
If I output the global asset field elsewhere in the template, I get this:
http://my-locl-url.dev/uploads/images/Placeholders/placeholder-image.png
If I hard-code this URL into my image code, the image works fine. So does anyone have any idea why using a global for the placeholder image in this way isn't working? Thanks for any help.