Dave Burke : Freelance .NET Web Developer specializing in Online Communities

CSGalleries RandomPicture Mod

I'm a sucker for CS mods, no question.  Now that I'm using CS 1.1 I'm seeing things I have to play with. 

Tonight I was looking at the CSGalleries home page on my site. I like the new CS 1.1 random image shown in the Gallery Details block, but ya know, it just wasn't finished.  Why couldn't I click on it to see the enlarged and original images?  So I added a hyperlink by overriding the base GalleryImage Render(HtmlTextWriter) method in the RandomPicture class.

But that was too simple a mod.  Why can't I display more than one random image, complete with hyperlinks?  Now I had a mod!  To do that I created a RandomPictures class which essentially spits out a Picture[] array of random pictures rather than a single image.

The method I added to the Galleries.Components.Pictures class looks like this.


public static Picture[] GetRandomPictures(int galleryID, int categoryID, int picNumber)
{
 Picture[] pictures = new Picture[picNumber];
 int postID;
 for (int i = 0; i < picNumber; i++)
 {
  postID = GalleryDataProvider.Instance().GetRandomPostID(galleryID, categoryID);
  pictures[i] = GetPicture( postID );
 }
 return pictures;
}

Here is the Gallery Details block before and after the mod.  Here is my CSGalleries Home Page for the real deal.  If you're interested in the mod, I zipped up the essentials here.


Comments (6) | Post RSS RSS comment feed

Posted on 8/29/2005 8:54:00 PM by Dave Burke
Categories: Community Server
Tags:

Related posts

Comments (6) -

8/30/2005 1:00:01 AM Permalink

I just noticed all your photos have -1 votes. I just voted on one and it got 0 votes. Laughing

Dennis van der Stelt |

8/30/2005 5:16:59 AM Permalink

Dennis,  Thanks for your observation.  I never noticed the voting component in CSGalleries.  Something not working in the CS 1.1 perhaps, or maybe some admin setting. I'll have to look into it, and will probably turn it off.  Thanks.

daveburke |

8/30/2005 7:52:36 AM Permalink

I'm gonna have to borrow this code and add it to my site.  I like it.  And (I know I said it before but), you take some nice pictures Dave.

That being said, welcome to 1.1.   Its still a little buggy, but better than 1.0.  1.2 will be here before we know it.

Dave Kekish |

8/30/2005 11:08:25 AM Permalink

Dave, thanks for the welcome to 1.1.  Yeah, I'm seeing a lot of errors in the system exception log.  Somehow I'm not as optimistic about 1.2 being here "before we know it," which is another reason I went to 1.1.

As for the pictures, shooting snapshots in Vermont with a 4MB camera is kinda like making lasagne--it's hard to screw up.

Let me know if you need any assistance with the randompicture mod.

daveburke |

8/31/2005 12:18:16 PM Permalink

I also get several errors a day from CS 1.1.   I think some of it is attributed to robots but I'm not sure.   Sometimes the whole site just shuts down but will be back up with no modifications in 5 minutes.

I'm hoping 1.2 is worth the wait.  Meanwhile I'm still playing around with Dasblog.

Dave Kekish |

8/31/2005 12:28:17 PM Permalink

Oooo, a possible defector????  That would be pretty huge.  Thanks for checking back, Dave!

daveburke |


Powered by BlogEngine.NET 2.0.0.36
Theme by Dave Burke