Hi,
I'm trying to add Derivatives to existing GalleryItems.
I hoped to find a function like: addDerivativeToItem($parentItem, $derivativeFilename);
Since I couldn't find something like that I thought about creating a GalleryDerivative-Object and assign the file to it. But GalleryDerivative doesn't seem to represent a file...
Does anyone have an advice how to add a custom Derivative to an existing GalleryItem?
Greetings from Germany
mecs
Posts: 4342
GalleryDerivative is not a subclass of GalleryFileSystemEntity and can't own a file. GalleryDerivatives must be derived (hence the name) from a GalleryItem with a sequence of 'operations' like resize, rotate, add watermark etc.
If an item has its own file it should be a subclass of GalleryFileSystemEntity, such as a GalleryItem.
Posts: 2
Thanks, that (and a look at the thumbnail-module) really helped me.
Now I'm able to add Items to the Gallery. My new problem is that my created Items are not included in $theme.imageViews, although I set the parent-field.
How is the data for $theme.imageViews collected and what do I have to do to have my item included?
Thanks in advance
mecs
Posts: 4342
in GalleryTheme::loadCommonTemplateData(...)
You're trying to add a custom derivative that is actually a different file, right? Then, yes, the thumbnail-module method is the way to go. But I don't think that the gallery structure is flexible enough to do what you want, since the thumbnail concept is built-in, whereas your own 'underived-derivative' isn't.
the $theme.imageViews is hard-coded to be built from some selection of the original item, the resizes and the thumbnail - I don't see a hook where you can slot in something else.