Hi there
I'm new to silverstripe - and I like it very much.
Currently I'm working on a portfolio website, that uses lots of images in different contexts.
On one page, there is a navigation-image (standard "Image" class) an imageDOM to handle multiple portfolio images (ClassName "PortfolioBild") and another imageDOM for additional pictures (ClassName "ReferenzBild").
Everything works fine and the look and feel with DOM and Uploadify is very nice.
Unfortunately, I ran into problem and would appreciate some help:
I would like to use the same uploaded picture for multiple purposes. But DOM/Silverstripe seems to filter by ClassName. Eg I upload an image as "PortfolioBild" and then I would like to import the same images as "ReferenzBild", the system will ignore my request. If I manually change the ClassName in the "file" table to "ReferenzBild", DOM will allow me to import the image, but it's no longer visible as "PortfolioBild".
This is how my Portfolio Class looks like (the ReferenzBild is almost the same):
class PortfolioBild extends Image {
static $db = array(
'Legende' => 'Text'
);
public static $has_one = array(
"Attachment" => "File",
"ContentImages" => "ContentImages"
);
}
The ContentImages looks like this:
class ContentImages extends Page {
static $db = array(
'Legende' => 'Text'
);
static $has_many = array(
'PortfolioImages' => 'PortfolioBild',
'ReferenzImages' => 'ReferenzBild'
);
static $has_one = array(
'Menubild' => 'Image'
);
function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab('Root.Content.Main', new TextField('Legende'), 'Content');
$fields->addFieldToTab("Root.Content.Navigation", new ImageField('Menubild'));
$images = new ImageDataObjectManager(
$this,
'PortfolioImages',
'PortfolioBild',
'Attachment',
array(),
'getCMSFields_forPopup'
);
$fields->addFieldToTab("Root.Content.Portfolio", $images);
$ref_images = new ImageDataObjectManager(
$this,
'ReferenzImages',
'ReferenzBild',
'Attachment',
array(),
'getCMSFields_forPopup'
);
$fields->addFieldToTab("Root.Content.Referenz", $ref_images);
return $fields;
}
}
How can I give my client three different areas to select images - and enabling him to use the same image on the same page in multiple areas?
Is there a way to tell my PortfolioBild and ReferenzBild classes to store as ClassName "Image"?
Any hint or help is very much appreciated.