Answers.Body: <p>Not possible out of the box, unfortunately. Asset transforms can be pulled by using the <a href="https://craftcms.com/classreference/services/AssetTransformsService#getTransformByHandle-detail" rel="nofollow noreferrer">AssetsTransformService</a>, but Craft doesn't expose that service to Twig (unlike the <a href="https://craftcms.com/classreference/services/AssetsService" rel="nofollow noreferrer">AssetsService</a>, which is what you're working with when you're using <code>craft.assets</code>).</p>
  
  <p>What you could do is to <a href="https://pluginfactory.io/" rel="nofollow noreferrer">create a simple, custom plugin</a> exposing the AssetsTransformsService to Twig by adding the following to a <a href="https://craftcms.com/docs/plugins/variables" rel="nofollow noreferrer">Variable</a> class in your plugin:</p>
  
  <pre><code>public function assetTransforms()
  {
      return craft()-&gt;assetTransforms;
  }
  </code></pre>
  
  <p>Then, you'd be able to do something like this in your templates:</p>
  
  <pre><code>{% set transform = craft.myPluginHandle.assetTransforms.getTransformByHandle('myTransformName') %}
  &lt;p&gt;The mode is {{ transform.mode }}&lt;/p&gt;
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-12-20T14:19:32.573Z
Answers.LastActivityDate: 2016-12-20T14:19:32.573Z
Answers.UserDisplayName: Mats Mikkel Rummelhoff
Body: <p>I work on a portfolio with a large number of images with very high sizes and a lot of images transforms. The server on which this site is hosted reach these limits (images generations process are generally blocked), so I would like to experiment with <a href="http://www.imgix.com" rel="nofollow noreferrer">imgix</a> in order to move the transformations of images in the cloud.</p>
  
  <p>I need to tell imgix how to crop images and I prefer to define my transformation types in the Control Panel rather than in the templates. How can I retrieve the mode of an image transformation from its his name?</p>
  
  <p>Is there something like <code>{{ craft.assets.getMode('myTransformName') }}</code> ? I haven't found a method for this in the documentation.</p>
  
Tags: <image-transforms><image><assetfilemodel><twigextension>
Title: How to retrieve the mode of an image transformation from its name?
ThreadText: # How to retrieve the mode of an image transformation from its name?
  
  (Asked by: username_0 on 2016-12-20)
  
  I work on a portfolio with a large number of images with very high sizes and a lot of images transforms. The server on which this site is hosted reach these limits (images generations process are generally blocked), so I would like to experiment with [imgix](http://www.imgix.com) in order to move the transformations of images in the cloud.
  
  I need to tell imgix how to crop images and I prefer to define my transformation types in the Control Panel rather than in the templates. How can I retrieve the mode of an image transformation from its his name?
  
  Is there something like `{{ craft.assets.getMode('myTransformName') }}` ? I haven't found a method for this in the documentation.
  
  **Tags:** image-transforms, image, assetfilemodel, twigextension
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-12-20. Score: 1 | Accepted answer
  
  Not possible out of the box, unfortunately. Asset transforms can be pulled by using the [AssetsTransformService](https://craftcms.com/classreference/services/AssetTransformsService#getTransformByHandle-detail), but Craft doesn't expose that service to Twig (unlike the [AssetsService](https://craftcms.com/classreference/services/AssetsService), which is what you're working with when you're using `craft.assets`).
  
  What you could do is to [create a simple, custom plugin](https://pluginfactory.io/) exposing the AssetsTransformsService to Twig by adding the following to a [Variable](https://craftcms.com/docs/plugins/variables) class in your plugin:
  
  ```
  public function assetTransforms()
  {
      return craft()->assetTransforms;
  }
  
  ```
  
  Then, you'd be able to do something like this in your templates:
  
  ```
  {% set transform = craft.myPluginHandle.assetTransforms.getTransformByHandle('myTransformName') %}
  <p>The mode is {{ transform.mode }}</p>
  
  ```
  
  
  ---
  
  