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)
{
?>
<li>
<div class="imgholder"><img src="<?php echo $entry->featuredImage[0]->url; ?>" alt="<?php echo $entry->featuredImage[0]->title; ?>"/></div>
<h4><?php echo $entry->title; ?></h4>
<?php echo $entry->body; ?>
</li>
<?php
}
echo $entry->featuredImage[0]->getUrl('small');