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.

All other Modules /

Discuss all other Modules here.

Moderators: martimiz, Sean, biapar, Willr, Ingo, swaiba, simon_w

Taming HasManyFileManager


Reply


4 Posts   1015 Views

Avatar
Mans

Community Member, 21 Posts

19 February 2009 at 5:59am

Edited: 19/02/2009 6:01am

Hi all!

I'm working on a site where I want to include one to several images with each page. My idea is that the images should be displayed as thumbnails in a row, and when clicked a larger version of the clicked image should appear. I looked at the Gallery module, but it seemed a little too clumsy for what I have in mind.

At first glance the HasManyFileManager module seemed right for the job, and as far as the [url=http://doc.silverstripe.org/doku.php?id=modules:hasmanyfilemanager]documentation[/url] goes it works like a charm. But I have no idea how to make it do anything more than that. The function $SetWidth() is mentioned, not nothing is said about what other functions are supported. But just being able to retrieve the URL of the image would take me far.

Any suggestions?

/MÃ¥ns

Avatar
Carbon Crayon

Community Member, 598 Posts

19 February 2009 at 6:12am

Hi Mans

the has many file manager is simply a way to manage files attached to a page. You can use any of the usual functions/variables in the template as you would for any other images on the files which are attached to a page.

For example: $Image.SetWidth(150), $Image.SetHeight(150), $Image.CroppedImage(150,150) etc.

and for image info $Image.URL or $Image.Title etc.

The GD docs show the image resizing functions, but unfortunately it only shows the functions you can use in your PHP classes, not the (strangely) renamed ones for the template: http://doc.silverstripe.org/doku.php?id=gd

hope that helps :)

Avatar
Mans

Community Member, 21 Posts

19 February 2009 at 6:18am

Aram, thanks! You saved my day!

/MÃ¥ns

Avatar
UncleCheese

4085 Posts

19 February 2009 at 7:37am

The ImageDataObjectManager is more feature-rich and would do a better job than the HasManyFileManager. That will be ready in a few days.