Lurk all you'd like, but why not register and post some pics? Registering also makes it easier to find the good stuff. Need help?

Go Back   Digital Grin Photography Forum > Support > SmugMug Customization
Dgrinner
Password
Register FAQ Shooters Calendar Reviews Tutorials Gallery Books Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old Jan-31-2006, 02:04 PM   #1
Reeves
One pixel short of sane
 
Reeves's Avatar
 
Join Date: Nov 2005
Posts: 16
Featuring my favorite pictures (featuring a keyword gallery)

Hey folks,

I wanted to have a section on my home page which featured my favorite pictures... but I didn't want to go through the labor of duplicating each picture into a new gallery to feature. After doinking with CSS for a while (and coming up very empty handed) I stumbled across devbobo's automatic "recent" featured gallery. Brilliant! As a result, I give all credit to devbobo since I really just trimmed and modified his code for this. Basically I modified devbobo's code to show a keyword gallery instead of a timeline gallery. You could, of course, use this for any keyword you choose.

You can see it in action on my site.

Note: my JS skills are minimal at best (well, I don't know JS, just C++) so I'd like to get your feedback on this tweak of David's code. It is working on my site but I may have done something silly in my futzing with the code.

I renamed the functions where appropriate to make it easier for this to coexist with the recent gallery should someone have the urge to merge them. Here's is the JavaScript code (again, copied shamelessly from devbobo):
Code:
function addKeywordFeatured(text, description, keyword, thumbUrl)
{
  if (IsClass("homepage"))
  {
    divTag = document.getElementById("featuredBox");
    if (divTag)
    {
      divTags = divTag.getElementsByTagName("div");
      for (i=0; i<divTags.length; i++)
      {
        if (divTags[i].className == "boxBottom")
        {
          miniBox = document.createElement("div");
          miniBox.className = "miniBox";
          photoBox = document.createElement("div");
          photoBox.className = "photo";
          miniBox.appendChild(photoBox);
          photoLink = document.createElement("a");
          photoLink.setAttribute("href", "/keyword/" + keyword);
          photoBox.appendChild(photoLink);
          photoImg = document.createElement("img");
          photoImg.setAttribute("border", "0");
          photoImg.setAttribute("alt", text);
          photoImg.setAttribute("title", text);
          photoImg.src = thumbUrl;
          photoImg.className = "imgBorder";
          photoLink.appendChild(photoImg);
          albumTitle = document.createElement("p");
          albumTitle.className = "albumTitle";
          miniBox.appendChild(albumTitle);
          albumLink = document.createElement("a");
          albumLink.className = "nav";
          albumLink.setAttribute("href", "/keyword/" + keyword);
          albumTitle.appendChild(albumLink);
          albumLinkText = document.createTextNode(text);
          albumLink.appendChild(albumLinkText);
 
          albumDescription = document.createElement("p");
          albumDescription.className = "description";
          miniBox.appendChild(albumDescription);
          albumDescriptionText = document.createTextNode(description);
          albumDescription .appendChild(albumDescriptionText);
          spacerDiv = document.createElement("div");
          spacerDiv.className = "spacer";
          miniBox.appendChild(spacerDiv);
          divTags[i].insertBefore(miniBox, divTags[i].childNodes[1]);
 
          break;
        }
      }
    }
  }
}
 
function IsClass(sClass) 
{
  sClassName = document.body.className;
  re = new RegExp(sClass + "( |$)") 
  if (!sClassName)
    return false;
  return re.test(sClassName);
}
Also in the JS customization section I have a function to call when the page is loaded. This function triggers the keyword customization as well as other customizations I have (removed from the example for clarity).
Code:
function OnLoadHandler()
{
   addKeywordFeatured('Favorite Pictures', 'Our favorite pictures from all our galleries.', 'Favorites', 'photos/54593627-Ti.jpg'); 
}
I originally used a body tag to trigger the function but devbobo pointed out that it will load more quickly if you put the onload command in the footer instead. At his recommendation I added the call to trigger the insertion via the footer instead of adding a body tag (note the asterixes should be removed):
Code:
<*script*>
    OnLoadHandler();
</script*>
That's about it. You can check out the results on my page.

Additional note:
The code for this customization changed at some point (possibly the server modified the code for security reasons). I've corrected the code in the post and, to make sure there is a clean copy available should it change again, I've also uploaded the script snippets here:Thanks again David (devbobo) for the code and inspiration.

Cheers,
Reeves

Last edited by Reeves; Sep-13-2006 at 06:14 AM. Reason: Correcting code
Reeves is offline   Reply With Quote
Old Jan-31-2006, 02:30 PM   #2
devbobo
technicolored
 
devbobo's Avatar
 
Join Date: Nov 2004
Location: Melbourne, AU
Posts: 4,308
Very cool Reeves...well done
__________________
David Parry
My Photos | SmugBrowser
devbobo is offline   Reply With Quote
Old Jan-31-2006, 02:33 PM   #3
Andy
SmugMug COO & House Pro
 
Andy's Avatar
 
Join Date: Dec 2003
Location: New York City
Posts: 52,623
And, there's a way to put that keyword gallery on your homepage

www.moonriverphotography.com

devbobo
__________________
Andy

Moon River PhotographyTwitterFacebook
Andy is offline   Reply With Quote
Old Jan-31-2006, 02:42 PM   #4
devbobo
technicolored
 
devbobo's Avatar
 
Join Date: Nov 2004
Location: Melbourne, AU
Posts: 4,308
Quote:
Originally Posted by Andy
And, there's a way to put that keyword gallery on your homepage

www.moonriverphotography.com

devbobo
couldn't help urself could u
__________________
David Parry
My Photos | SmugBrowser
devbobo is offline   Reply With Quote
Old Jan-31-2006, 02:56 PM   #5
Andy
SmugMug COO & House Pro
 
Andy's Avatar
 
Join Date: Dec 2003
Location: New York City
Posts: 52,623
Quote:
Originally Posted by devbobo
couldn't help urself could u
, no, I cannot!

I'm constantly amazed at what can be done with a SmugMug site. Thanks mucho for the hacks, David!
__________________
Andy

Moon River PhotographyTwitterFacebook
Andy is offline   Reply With Quote
Old Jan-31-2006, 03:05 PM   #6
Reeves
One pixel short of sane
 
Reeves's Avatar
 
Join Date: Nov 2005
Posts: 16
Okay boys... what's the noob missing? :) (was there already a way to do this?)

Quote:
Originally Posted by Andy
, no, I cannot!

I'm constantly amazed at what can be done with a SmugMug site. Thanks mucho for the hacks, David!
Reeves is offline   Reply With Quote
Old Jan-31-2006, 03:19 PM   #7
devbobo
technicolored
 
devbobo's Avatar
 
Join Date: Nov 2004
Location: Melbourne, AU
Posts: 4,308
Quote:
Originally Posted by Reeves
Okay boys... what's the noob missing? :) (was there already a way to do this?)
check out Andy's homepage, I just finished writing a hack last night that puts an album of user's choice on ur homepage in a slideshow.
__________________
David Parry
My Photos | SmugBrowser
devbobo is offline   Reply With Quote
Old Jan-31-2006, 04:22 PM   #8
Reeves
One pixel short of sane
 
Reeves's Avatar
 
Join Date: Nov 2005
Posts: 16
Quote:
Originally Posted by devbobo
check out Andy's homepage, I just finished writing a hack last night that puts an album of user's choice on ur homepage in a slideshow.
That is wicked cool! Very nice.
Reeves is offline   Reply With Quote
Old Jan-31-2006, 04:47 PM   #9
Barb
SmugMug Help Moddess
 
Barb's Avatar
 
Join Date: May 2005
Location: Boise, ID
Posts: 3,310
Quote:
Originally Posted by devbobo
check out Andy's homepage, I just finished writing a hack last night that puts an album of user's choice on ur homepage in a slideshow.
That is wonderful! It gives me an idea, but I have no clue how to do it. On my home page, would it be possible, if I removed my bio from the homepage, to have a slideshow kind of like Andy's, of a certain gallery, i.e., "Favorites", in that space? I would leave everything else alone. Does that make sense? Eesh, even after I read it, I know what I mean, but no one else may - LOL.
Barb is offline   Reply With Quote
Old Jan-31-2006, 05:37 PM   #10
devbobo
technicolored
 
devbobo's Avatar
 
Join Date: Nov 2004
Location: Melbourne, AU
Posts: 4,308
Quote:
Originally Posted by bygates
That is wonderful! It gives me an idea, but I have no clue how to do it. On my home page, would it be possible, if I removed my bio from the homepage, to have a slideshow kind of like Andy's, of a certain gallery, i.e., "Favorites", in that space? I would leave everything else alone. Does that make sense? Eesh, even after I read it, I know what I mean, but no one else may - LOL.
Hi Barb,

I am going to be writing up a tutorial on how to do this...stay tuned.

David
__________________
David Parry
My Photos | SmugBrowser
devbobo is offline   Reply With Quote
Old Jan-31-2006, 05:42 PM   #11
Andy
SmugMug COO & House Pro
 
Andy's Avatar
 
Join Date: Dec 2003
Location: New York City
Posts: 52,623
Quote:
Originally Posted by bygates
That is wonderful! It gives me an idea, but I have no clue how to do it. On my home page, would it be possible, if I removed my bio from the homepage, to have a slideshow kind of like Andy's, of a certain gallery, i.e., "Favorites", in that space? I would leave everything else alone. Does that make sense? Eesh, even after I read it, I know what I mean, but no one else may - LOL.
You can have the gallery be anything! Any gallery you want. I like reeves' idea here about the keyworded favorites - way cool. But really, the slideshow is served up by javascript from a regular gallery on SmugMug.
__________________
Andy

Moon River PhotographyTwitterFacebook
Andy is offline   Reply With Quote
Old Jan-31-2006, 05:52 PM   #12
Barb
SmugMug Help Moddess
 
Barb's Avatar
 
Join Date: May 2005
Location: Boise, ID
Posts: 3,310
Quote:
Originally Posted by devbobo
Hi Barb,

I am going to be writing up a tutorial on how to do this...stay tuned.

David
Barb is offline   Reply With Quote
Old Jan-31-2006, 05:53 PM   #13
Barb
SmugMug Help Moddess
 
Barb's Avatar
 
Join Date: May 2005
Location: Boise, ID
Posts: 3,310
Quote:
Originally Posted by Andy
You can have the gallery be anything! Any gallery you want. I like reeves' idea here about the keyworded favorites - way cool. But really, the slideshow is served up by javascript from a regular gallery on SmugMug.
I tried reeves' script but it wasn't working, and i'm too tired to try to figure it out. But I really think it's a great idea!
Barb is offline   Reply With Quote
Old Feb-02-2006, 08:00 AM   #14
Barb
SmugMug Help Moddess
 
Barb's Avatar
 
Join Date: May 2005
Location: Boise, ID
Posts: 3,310
Quote:
Originally Posted by Reeves
Hey folks,

I wanted to have a section on my home page which featured my favorite pictures... but I didn't want to go through the labor of duplicating each picture into a new gallery to feature. After doinking with CSS for a while (and coming up very empty handed) I stumbled across devbobo's automatic "recent" featured gallery. Brilliant! As a result, I give all credit to devbobo since I really just trimmed and modified his code for this. Basically I modified devbobo's code to show a keyword gallery instead of a timeline gallery. You could, of course, use this for any keyword you choose.
Finally had the time to implement this on my site. And I gotta say, I love it! I had previously made a separate gallery called "Favorites" and make second copies of certain photos to place in that gallery. This eliminates that altogether and works flawlessly for me. Thank you!
Barb is offline   Reply With Quote
Old Feb-02-2006, 10:33 AM   #15
Reeves
One pixel short of sane
 
Reeves's Avatar
 
Join Date: Nov 2005
Posts: 16
Quote:
Originally Posted by bygates
Finally had the time to implement this on my site. And I gotta say, I love it! I had previously made a separate gallery called "Favorites" and make second copies of certain photos to place in that gallery. This eliminates that altogether and works flawlessly for me. Thank you!
Glad to hear it's up and running. (Your pictures look great!)
Reeves is offline   Reply With Quote
Old Feb-02-2006, 10:37 AM   #16
Barb
SmugMug Help Moddess
 
Barb's Avatar
 
Join Date: May 2005
Location: Boise, ID
Posts: 3,310
Quote:
Originally Posted by Reeves
Glad to hear it's up and running. (Your pictures look great!)
Thank you!
Barb is offline   Reply With Quote
Old Feb-03-2006, 07:49 AM   #17
juliank
Big grins
 
Join Date: Jan 2006
Posts: 26
Home - slideshow

Andy,

Where can I find info how to implement a slideshow like you have on your homepage? (www.moonriverphotography.com_)

Thanks in advance!

Julian
juliank is offline   Reply With Quote
Old Feb-03-2006, 11:39 AM   #18
DodgeV83
Major grins
 
Join Date: Aug 2005
Posts: 376
Quote:
Originally Posted by juliank
Andy,

Where can I find info how to implement a slideshow like you have on your homepage? (www.moonriverphotography.com_)

Thanks in advance!

Julian
You'll have to wait for Devbobo to write a tutorial.
DodgeV83 is offline   Reply With Quote
Old Feb-25-2006, 09:05 AM   #19
Redskeeter
Big grins
 
Redskeeter's Avatar
 
Join Date: Feb 2006
Posts: 36
Got it working, almost flawlessly...

I figured out how to include the code and get it working, how the heck you guys figger this stuff out is amazing... good work.

Now for the head scratcher: The behavior when displaying horizontal vs vertical pictures gives some strange behavior, at least in IE 6. Seems the large picture of the thumbnail (displayPhoto), when horizontal goes to the bottom of the page. When you try to scroll down, IE just sort of jiggles but does not move unless you use the scroll bar.

In my other galleries, the style of the display photo is such that it fits beside the thumbs. I also note the thumbnail overlaps the text in firefox on the created gallery. I guess there is something not getting set somewhere. More on the customization angle, how do you get Guess I'll need "professional help" to fix this one.

Is this some of this sort of thing going into the How To that is in the works?

Thanks to all who work on this stuff!

www.wildstate.com is the site, btw

Evidently, I didn't make it clear where the "featured gallery" with keywords is located, it is located at www.wildstate.com, my smugmug site.
__________________
Wildlife & Nature Photography

Last edited by Redskeeter; Feb-25-2006 at 10:19 AM.
Redskeeter is offline   Reply With Quote
Old Feb-25-2006, 10:49 AM   #20
Mike Lane
I � Unicode
 
Mike Lane's Avatar
 
Join Date: Feb 2005
Location: Dover, DE
Posts: 7,059
Quote:
Originally Posted by Redskeeter
Now for the head scratcher: The behavior when displaying horizontal vs vertical pictures gives some strange behavior, at least in IE 6. Seems the large picture of the thumbnail (displayPhoto), when horizontal goes to the bottom of the page. When you try to scroll down, IE just sort of jiggles but does not move unless you use the scroll bar.
What page are you talking about exactly?

Quote:
Originally Posted by Redskeeter
In my other galleries, the style of the display photo is such that it fits beside the thumbs. I also note the thumbnail overlaps the text in firefox on the created gallery. I guess there is something not getting set somewhere. More on the customization angle, how do you get Guess I'll need "professional help" to fix this one.
I need a specific example to help you out.
__________________
Y'all don't want to hear me, you just want to dance.

http://photos.mikelanestudios.com/
Mike Lane is offline   Reply With Quote
Reply

Tell The World!

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


Times are GMT -8.   It's 09:24 AM.


Powered by vBulletin® Version 3.8.5
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.