<p><code>$entry-&gt;featuredImage[0]-&gt;getUrl('small');</code> works.</p>

CC BY-SA 3.0
2016-05-12T12:26:19.977Z
2016-05-12T16:52:52.857Z
2016-05-12T16:52:52.857Z
Jamie
<p>I’m using Craft to add CMS functionality to an e-commerce website via <code>craft/app/bootstrap.php</code></p>

<p>Trying to pull a 'timeline' structure with a <code>featuredImage</code> Asset Field. </p>

<p>This code works and pulls the full size image, but I can’t work out how to pull the ‘small’ size of image which is set up as a transform.</p>

<p>I assume it should be something like <code>$entry-&gt;featuredImage[0]-&gt;url['small']</code> but nothing seems to be working. </p>

<p>Any help appreciated.</p>

<pre><code>$timeline = Craft\craft()-&gt;elements-&gt;getCriteria(Craft\ElementType::Entry);
$timeline-&gt;section = 'timeline';
$timeline-&gt;with = 'featuredImage';
$timeline-&gt;withTransforms = 'small';

foreach ($timeline as $entry)
{                       
  ?&gt;
      &lt;li&gt;
          &lt;div class="imgholder"&gt;&lt;img src="&lt;?php echo $entry-&gt;featuredImage[0]-&gt;url; ?&gt;" alt="&lt;?php echo $entry-&gt;featuredImage[0]-&gt;title; ?&gt;"/&gt;&lt;/div&gt;
          &lt;h4&gt;&lt;?php echo $entry-&gt;title; ?&gt;&lt;/h4&gt;
          &lt;?php echo $entry-&gt;body; ?&gt;
       &lt;/li&gt;
  &lt;?php
}   
</code></pre>

CC BY-SA 3.0
2016-05-12T01:21:50.877Z
Completely untested so adding as a comment, but try: `echo $entry->featuredImage[0]->getUrl('small');`
Brad Bell
<image-transforms><php><image><bootstrap-craft>
PHP transformed image?
# PHP transformed image?

(Asked by: username_0 on 2016-05-11)

I’m using Craft to add CMS functionality to an e-commerce website via craft/app/bootstrap.php
Trying to pull a 'timeline' structure with a featuredImage Asset Field. 
This code works and pulls the full size image, but I can’t work out how to pull the ‘small’ size of image which is set up as a transform.
I assume it should be something like $entry->featuredImage[0]->url['small'] but nothing seems to be working. 
Any help appreciated.
$timeline = Craft\craft()->elements->getCriteria(Craft\ElementType::Entry);
$timeline->section = 'timeline';
$timeline->with = 'featuredImage';
$timeline->withTransforms = 'small';

foreach ($timeline as $entry)
{                       
  ?>
      
          
          title; ?>
          body; ?>

**Tags:** image-transforms, php, image, bootstrap-craft
> **Comments:**
> **username_1**: Completely untested so adding as a comment, but try: `echo $entry->featuredImage[0]->getUrl('small');`  

---

## 1 answers

### Answer by username_0 on 2016-05-12. Score: 3

`$entry->featuredImage[0]->getUrl('small');` works.


---

