<p>I seem to have worked it out - by specifying </p>

<pre><code>'imageDriver' =&gt; 'gd'
</code></pre>

<p>in the config. I first tried to specify 'imageDriver' => 'imagick', but I was getting path error messages so I'm guessing it is not installed on the PHP installation I am using.</p>

<p>More info at
<a href="https://craftcms.stackexchange.com/questions/6626/errors-with-craft-2-3-imagine-and-imagick">Errors with Craft 2.3, Imagine and Imagick</a></p>

CC BY-SA 3.0
2015-02-10T00:10:36.553Z
2015-02-10T00:10:36.553Z
2017-04-13T12:51:00.303Z
Jack McKenzie
<p>I'm trying to call an image via an image transform from a matrix field.</p>

<p>So when I do this:</p>

<pre><code>{% if block.type == "standardImage" %}
  {% set image = block.imageFile.first() %}
  {% if image %}
      &lt;img src="{{ image.url('generalImageTransform') }}" width="{{ image.getWidth('generalImageTransform') }}" 
      height="{{ image.getHeight('generalImageTransform') }}" alt="{{ image.title }}"&gt;
  {% endif %}
{% endif %}
</code></pre>

<p>I get this:</p>

<pre><code>&lt;img src="http://.../cpresources/transforms/1?x=DrK2WYEvg" width="600" height="601" alt="district"&gt;
</code></pre>

<p>So you can see the width, height and title are all being called successfully, but the image is broken on the web page.</p>

<p>And when I skip the transform and just use <code>{{ image.url() }}</code> the image is called successfully with </p>

<pre><code>&lt;img src="/images/general/district.png" width="600" height="601" alt="district"&gt;
</code></pre>

<p>Finally when I add this to the config file</p>

<pre><code>'generateTransformsBeforePageLoad' =&gt; true,
</code></pre>

<p>I get a PHP error</p>

<pre><code>Image “district.png” cannot be found.
</code></pre>

<p>I suspect then that the transformed image is unable to be created, but I don't know how to progress this idea, or if I am on the right track at all.</p>

<image-transforms>
Error when calling an image transform from matrix field
# Error when calling an image transform from matrix field

(Asked by: username_0 on 2015-02-09)

I'm trying to call an image via an image transform from a matrix field.
So when I do this:
{% if block.type == "standardImage" %}
  {% set image = block.imageFile.first() %}
  {% if image %}
      
  {% endif %}
{% endif %}

I get this:


So you can see the width, height and title are all being called successfully, but the image is broken on the web page.
And when I skip the transform and just use {{ image.url() }} the image is called successfully with 


Finally when I add this to the config file
'generateTransformsBeforePageLoad' => true,

I get a PHP error
Image “district.png” cannot be found.

I suspect then that the transformed image is unable to be created, but I don't know how to progress this idea, or if I am on the right track at all.

**Tags:** image-transforms

---

## 1 answers

### Answer by username_0 on 2015-02-10. Score: 4 | Accepted answer

I seem to have worked it out - by specifying 
'imageDriver' => 'gd'

in the config. I first tried to specify 'imageDriver' => 'imagick', but I was getting path error messages so I'm guessing it is not installed on the PHP installation I am using.
More info at
Errors with Craft 2.3, Imagine and Imagick


---

