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.

All other Modules /

Discuss all other Modules here.

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

Image Gallery Extension: Testers Needed


Go to End


417 Posts   117812 Views

Avatar
UncleCheese

Forum Moderator, 4102 Posts

6 May 2009 at 2:00am

I would LOVE to find a better way to do this. The die() statement was supposed to be a temporary fix, but ended up sticking because nothing else works. I opted not to use a redirect because people who have only one album are going to want the URL /my-gallery/ to show all their photos and not /my-gallery/album/DefaultAlbum. I know that would get a negative reaction. I wouldn't want it, myself.

Anyone else? I wonder if that code needs to be moved to the index() action instead of init().

Avatar
jhirm

Community Member, 21 Posts

6 May 2009 at 2:20am

Edited: 06/05/2009 3:23am

Moving the die() to the index() function solved the security problem for me without the sloppy URL... good call!

In the init() I now have:

if(!isset($this->urlParams['Action'])) {
//SingleAlbumView, handled in index()
} elseif($this->CurrentAlbum()) {
$this->includeUI();
}

And in the index() is the die():

public function index() {
if(!isset($this->urlParams['Action'])) {
if($this->SingleAlbumView()) {
die($this->renderWith(array('ImageGalleryPage_album','Page')));
}
}
}

EDIT: It doesn't get rid of the unconventional use of die() though...

Avatar
Liam

Community Member, 470 Posts

6 May 2009 at 3:29pm

So I finally got around to installing this on the latest nestedurls update and ran into an error.

When I try to add/edit an album I get this error in the lightbox window in the cms admin.

Fatal error: Call to a member function getErrors() on a non-object in /home/dreamer/public_html/new/sapphire/forms/Form.php on line 543

I know you don't deal with nestedurls, but any thoughts on this?

I'm in a jam because it's a very important project to use sub urls, and this photo gallery will be a main page of the site with 100s of albums over the long run. Gah.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

6 May 2009 at 4:07pm

Yeah, I've never used that module. Do you have any instances of a DataObjectManager running successfully? Because the albums interface is just a straight DataObjectManager -- nothing fancy going on. I have a feeling if that is failing for you, then DataObjectManager is not compatible with NestedURLs, which means perhaps ComplexTableField isn't, either, because they both use the same URL handlers.

Hmm..

Avatar
Liam

Community Member, 470 Posts

6 May 2009 at 4:22pm

No, I just installed the whole package and used it out of the box. To be honest, this is the first time working with dataobject_manager and the image gallery. I haven't even taken the time to learn how to use it, I just did a quick upload to test to see if it would work out of the box before spending too much time with it.

I have a feeling you're right and it's just not compatible. Gah now I really have no idea what to do with this situation...

Avatar
Felicia

Community Member, 7 Posts

8 May 2009 at 5:44pm

Edited: 08/05/2009 6:56pm

Hi Uncle Cheese,
The NextAlbum function is not returning the next album. It is actually returning the last album. Has anyone else seen this problem?
I just re-installed all the newest versions of DataObjectManager, ImageGallery, & SWFUploadField, but no luck.
I also tried re-sorting the albums and then placing them back to their original positions with no luck. Please help!

You can see what I am talking about here: http://66.147.242.166/~pascetti/railings-stairs/album/Cable-Railings

Thank you for your help!

*** I got it ***

*I changed the ImageGalleryPage.php file *
from this

* * * *
public function NextAlbum()
{
return $this->adjacentAlbum("next");
}
* * * *

to this

* * * *
public function NextAlbum()
{
return DataObject::get_one(
"ImageGalleryAlbum",
"ImageGalleryPageID = {$this->ID} AND SortOrder > {$this->CurrentAlbum()->SortOrder}",
false,
"SortOrder ASC"
);

}
* * * *

It is now working. Yay!

Avatar
Yulia

Community Member, 26 Posts

9 May 2009 at 1:29am

Hi!

i have a question...

I have many albums on one page, they positioned vertically and description goes on right. the page gets too long because of that. How to do, so after certain amount of albums it will create next page, like in forums here... 1.2.3 so on...?

another question, i would like to be able to display feature album or images on home page, or most recent ones. It could be just an image, or little slideshow?

Is there anybody who thought of it, because i am kind of stuck... )

thank you so much!

great work

Yulia

Avatar
UncleCheese

Forum Moderator, 4102 Posts

9 May 2009 at 1:39am

@LeeUmm - Can you confirm whether ComplexTableFields are working the NestedURLs module?

@Felicia - I'm aware of this issue. The solution is to just sort the album list once. It happens because the albums are not getting a default sort order on creation.

@Yulia - I haven't set up pagination on the albums list yet. I should probably add that in. As far as a featured image, gallery, or album, that's something you need to handle in your HomePage object.

$has_one = array('FeaturedAlbum');

$fields->addFieldToTab("Root.Content.Main, new DropdownField('FeaturedAlbumID','Featured Album', DataObject::get("ImageGalleryAlbum")->toDropdownMap('ID','AlbumName')));

and on your template

<% control Featured Album %>

Of course, you could substitute ImageGalleryImage or ImageGalleryPage in that code, as well.

Go to Top