Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

[image_gallery] album cover images / thumbnails


Go to End


7 Posts   1664 Views

Avatar
HaraldC

Community Member, 4 Posts

1 September 2010 at 5:30am

Hi,

New to SilverStripe and trying to set up a site presenting paintings (not mine) using the image_gallery module.

1. How can I have the album cover images be displayed respecting their aspect ratio?
The artist would not accept any cropping or distortion there.
I hope for something like for the image thumbnails where only the height is entered.
Leaving the width field in the configuration empty changed it to zero and I got the error already discussed here.

2. How and where can I change the code so that the image thumbnails "blocks" of an album are also vertically aligned, i.e. like them being located centered in a table cell?

3. Is there another way to limit the number of thumbnails shown in a row other then by their dimension as that is not very reliable when one has thumbnails with different widths.
A table-like approach would also solve this problem. I also hate tables, but what alternative is there in SilverStripe?

Thanks for any help!
Harald

Avatar
UncleCheese

Forum Moderator, 4102 Posts

1 September 2010 at 5:53am

Keep in mind, the templates and CSS that come with a module are just default implementations. You should copy them to your theme to override them as needed.

1) Make a copy of /image_gallery/templates/Includes/AlbumList.ss and place it in YOUR_THEME_DIR/templates/Includes/AlbumList. Instead of:
<% control FormattedCoverImage %>
<img src="$URL" alt="" />
<% end_control %>

You could do something like:

$CoverImage.SetHeight(100)

Remember to ?flush=1.

2) The CSS is themeable. Just copy /image_gallery/css/ImageGallery.css to YOUR_THEME_DIR/css/ImageGallery.css. Make any adjustments you need to get the presentation you like.

3) Same thing as #1. Copy over ImageGalleryPage_album.ss to its parallel location in your theme, and make any changes you need. A table is not appropriate in this view since the gallery is not tabular data. To show fewer results per row, you can either change the width of the LI tags, increase their margins/padding, increase the size of the thumbnails (on the Configuration tab in the CMS), or decrease the width of the containing UL -- all of which can be done with your override templates or stylesheet.

Avatar
HaraldC

Community Member, 4 Posts

1 September 2010 at 8:38am

Hi UncleCheese,

That was quick! Thank you.
I will try to apply that in the next days (quite busy now!).

Harald

Avatar
HaraldC

Community Member, 4 Posts

1 September 2010 at 10:06am

UncleCheese wrote:
1) Make a copy of /image_gallery/templates/Includes/AlbumList.ss and place it in YOUR_THEME_DIR/templates/Includes/AlbumList. Instead of:
<% control FormattedCoverImage %>
<img src="$URL" alt="" />
<% end_control %>

You could do something like:

$CoverImage.SetHeight(100)

Remember to ?flush=1.
----

I have done that (and the rest), but did not change anything else.
There is no change, the cover images are still displayed strictly according to the width and height settings on the configuration page.

Harald

Avatar
UncleCheese

Forum Moderator, 4102 Posts

1 September 2010 at 12:25pm

Oh, whoops. there's a typo in my original post. That should say "YOUR_THEME_DIR/templates/Includes/AlbumList.ss"

Avatar
HaraldC

Community Member, 4 Posts

1 September 2010 at 8:33pm

No problem, I guessed that and had copied it as ".../AlbumList.ss" already. So that's not an issue.
But the problem of the cover images still exist. (I did not test any further yet.)

Newbie question, just to be sure: to "?flush=1" as you said, I entered "http://my.domain.com/?flush=1". Was that correct?
(So far I did not quite understand when and where and how to apply "/dev/build" / "?flush=1" (I thought that was replaced by "/dev/build") / "/dev/build?flush=all" as the documentation is not very consistent in this point.)

Avatar
UncleCheese

Forum Moderator, 4102 Posts

2 September 2010 at 1:31am

/dev/build is used to update table definitions in the database. So if you modify the $db or $has_one array, you need to run that command. ?flush=1 is used when you create a new template. Silverstripe caches the template manifest, so you need to clear that and rebuild if you have created or modified a template.

I can't really explain why you wouldn't be seeing the override template. Can you put some text in your new one and confirm that it isn't displaying? What are the exact paths of both the original and override templates?