I'm trying to get several images from a DataList into a viewer. However, the function returns the values inside the 'File' table of SilverStripe.
my code:
FotoPagina.php
class FotoPagina extends Page {
...
public static $has_many = array(
'MyFotos'=>'FotoItem'
);
...
}
class FotoPagina_Controller extends Page_Controller {
...
function getFotos(){
$list = DataList::create('FotoItem')->relation('Foto')->where('FotoItemID = '.$_GET['id']);
return $list;
}
...
}
FotoItem.php
class FotoItem extends DataObject {
...
public static $many_many = array(
'Foto'=>'Image'
);
...
}
Page.ss
<% loop getFotos %>
<li>
<a class="thumb" name="optionalCustomIdentifier $ID" href="$Filename">
<img src="$Filename"/>
</a>
</li>
<% end_loop %>
SS will output the $ID and the Filename, but I need to get the image object, so I can set the $Image.setWidth(140) option. Is there a way to get this with the DataList, or is there any other option?