Answers.Body: <p>You can easily do this in twig with a conditional that checks if the width of the image is larger than your target transforms width. Try something like this:</p>
  
  <pre><code>{% if image.getWidth()&gt;600 %}
    &lt;img src="{{ image.getUrl({ width: 600 }) }}"&gt;
  {% else %}
    &lt;img src="{{ image.getUrl() }}"&gt;
  {% endif %}
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-10-08T15:13:00.107Z
Answers.LastActivityDate: 2014-10-08T15:13:00.107Z
Answers.UserDisplayName: André Elvan
Body: <p>At the moment I have an image 300px wide, my transform is set to a width of 600px so it upscales it. </p>
  
  <p>I would like it to only transform if the image is over 600px. </p>
  
  <p>Is this possible or should I use some other image manipulation thing like phpthumb?</p>
  
Tags: <image-transforms><image>
Title: Image transform that only crops if image is larger than set dimensions
ThreadText: # Image transform that only crops if image is larger than set dimensions
  
  (Asked by: username_0 on 2014-10-08)
  
  At the moment I have an image 300px wide, my transform is set to a width of 600px so it upscales it.
  
  I would like it to only transform if the image is over 600px.
  
  Is this possible or should I use some other image manipulation thing like phpthumb?
  
  **Tags:** image-transforms, image
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2014-10-08. Score: 4 | Accepted answer
  
  You can easily do this in twig with a conditional that checks if the width of the image is larger than your target transforms width. Try something like this:
  
  ```
  {% if image.getWidth()>600 %}
    <img src="{{ image.getUrl({ width: 600 }) }}">
  {% else %}
    <img src="{{ image.getUrl() }}">
  {% endif %}
  
  ```
  
  
  ---
  
  