Hi All,
I have a very simple gallery page set up using a DataObject.... it allows me to upload multiple images to a single page on my site.
Here are the relevant files :
/mysite/code/galleryImages.php
class galleryImages extends DataObject {
static $db = array(
'Title' => 'Text'
);
static $has_one = array(
'Image' => 'Image',
'GalleryPage' => 'GalleryPage'
);
public function getCMSFields_forPopup() {
return new FieldSet(
new TextField('Title'),
new FileIFrameField('Image')
);
}
}
/mysite/code/GalleryPage.php
class GalleryPage extends Page {
static $has_many = array(
'Images' => 'galleryImages'
);
public static $db = array(
);
public static $has_one = array(
);
public function getCMSFields() {
$f = parent::getCMSFields();
$manager = new ImageDataObjectManager(
$this,
'Images',
'galleryImages',
'Image',
array(
'Title' => 'Title'
),
'getCMSFields_forPopup'
);
$f->addFieldToTab("Root.Content.Gallery", $manager);
return $f;
}
}
class GalleryPage_Controller extends Page_Controller {
}
and a snippet from /themes/..../GalleryPage.ss
<div id="gallerySlider">
<% control Images %>
<a class="gallerythumb" href="$Image.URL" title="$Caption">$Image.SetRatioSize(120,110)</a>
<% end_control %>
</div>
Now... all of the above is working well... I can upload and re-order the images in the CMS, etc. and they get displayed properly in the template. The real question... is there any way to get the *actual* width of the thumbnail images which are being created using SetRatioSize() ? The reason being that I need to put some inline styling into the page (i.e. <img style="width: blah;" src="" />)
Any ideas ?
Cheers all
Tim