How do I embed Gallery2 thumbnails into my homepage?

afterdark

Joined: 2008-09-10
Posts: 56
Posted: Mon, 2009-07-20 11:45

I've got a website here...
http://www.afterdarkmodels.com/gallery.html

...in which I've temporarily hard-coded thumbnails & links from here:
http://afterdarkmodels.com/gallery/main.php

How do I replace the div of 9 thumbnails on my page with the one from the gallery page?

I need the glowing borders and titles from the Gallery page too, as these are also hardcoded on my homepage.

I don't want the Gallery header and log-in functionality on the final page, but I do want the "Page: 1 2 3 4 5" functionality, shown (though only at the bottom).

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2009-07-20 12:39
 
afterdark

Joined: 2008-09-10
Posts: 56
Posted: Mon, 2009-07-20 14:44

Thanks, that first link looks like just the thing I'm after Suprsidr.

Is it possible to use it to get the "Page: 1 2 3 4 5" pulled in from Gallery too? (I'm not a big coder at all)

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2009-07-20 15:41

If you are wanting to show an entire album with pagenation, it would be better to use the third choice and set the Default AlbumId and the Breadcrumb RootId to the album you are wanting to display.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
afterdark

Joined: 2008-09-10
Posts: 56
Posted: Tue, 2009-07-28 20:53

I've tried generating the script using the Embed-o-rator but am getting a Fatal error: Undefined class name 'galleryembed' on line 3 when I view the page.

Any idea what's up?

Also, I noted in the instructions when pasting in my original HTML code, it mentioned 'everything up to the cell' and to 'close the cell' - will this script only work with tables? My whole site is built with divs, no tables.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2009-07-28 21:13

the full system path to your gallery's embed.php
something like
/usr/local/www/vhosts/mysite.com/gallery2/embed.php for your server.
or if you are placing the script in or near your gallery2 directory, relative path is ok too - but the full path makes it more portable.

a div is a type of cell.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
afterdark

Joined: 2008-09-10
Posts: 56
Posted: Tue, 2009-07-28 23:26

Never seen a full system path like that before! (I'm a designer :D) but I think I've got it right as it's stopped the error.

So it's sort of working - for some reason I've lost some of my stylesheet elements, but I can probably figure that out myself.

However I wasn't expecting the sidebar links and gallery header to be there, or the text that says 'This is the main page of your Gallery' - can I get rid of them? See how they appear here:
http://www.afterdarkmodels.com/gallery/gallery2Embedded.php

Also need to lose the link to Gallery2 at the bottom (and and the others that appear when I'm logged in). Is that possible?

[I've left the background grey so I can see the positioning of the pulled in elements, when they're correct I'll turn it to black :)]

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2009-07-29 00:03

Looks like a work in progress, but you seem to have the gist.

To remove gallery's logo, you do have to edit that out of theme.tpl as well as the footer badges.
if you add $gallery->setConfig('showSidebarBlocks', false); before $g2data = GalleryEmbed::handleRequest(); it should hide the sidebarblocks.

In my carbon theme.css I have simply removed all of the background-color so for any embedding scenario the page controls the bg-color.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2009-07-29 00:05

you also need to set the embedUri to '/gallery/gallery2Embedded.php' in the init array near the top of the script, so the links show the images within your page.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
afterdark

Joined: 2008-09-10
Posts: 56
Posted: Tue, 2009-09-22 22:51

Had to take a break from this project but am back now. :)

How do I make the slide out Sidebar invisible for guests (and containing cell collapsed), but visible for admin?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2009-09-22 23:33

something like:

function isAnon() {
    global $gallery;
    list($ret, $isAnon) = GalleryCoreApi::isAnonymousUser();
    if ($ret) {
        print "Error checking user:".$ret->getAsHtml();
    }
    return $isAnon;
}

if(isAnon()){
    $gallery->setConfig('showSidebarBlocks', false);
}else{
    $gallery->setConfig('showSidebarBlocks', true);
}

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
afterdark

Joined: 2008-09-10
Posts: 56
Posted: Tue, 2009-09-29 21:58

Which file should that script go in? I tried putting it in the gallery2Embedded.php file in place of the existing line:

$gallery->setConfig('showSidebarBlocks', false);

but it didn't seem to work.

Also, If I totally remove the login/logout button by editing it out of my customized theme.tpl, is there a way I can still log in/out? (ie make a separate admin login type page, or make a page that uses a different theme where the buttons aren't omitted)

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2009-09-29 22:44

it would go in gallery2Embedded.php before the handleRequest call.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2009-09-29 22:45

You can also use $gallery->setConfig('login', false);

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
afterdark

Joined: 2008-09-10
Posts: 56
Posted: Wed, 2009-09-30 20:44

Well, I've sort of nearly got it all working now, managed to strip out all the elements I don't want.

However, I still can't get the gallery2Embedded.php page to only show the div of thumbnails.

See here: http://www.afterdarkmodels.com/gallery/gallery2Embedded.php - There's still a dark grey block behind the panel of thumbnails (which holds the gallery Title and has a link to the Sidebar and Login, etc)

How do I remove this from block the gallery2Embedded.php page (Only from gallery2Embedded.php - I need it in the main.php as it contains all the maintenance links, etc)

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2009-09-30 20:52

Ok, remove all background color from gallery/themes/carbon/theme.css (unless you want the sidebar to have some bgcolor)
If you change gallery2Embedded.php embedUri to /gallery/gallery2Embedded.php every page will remain within your custom page.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
afterdark

Joined: 2008-09-10
Posts: 56
Posted: Wed, 2009-09-30 22:05
suprsidr wrote:
Ok, remove all background color from gallery/themes/carbon/theme.css (unless you want the sidebar to have some bgcolor)

Should I do that with a duplicate in a folder called 'local' or is it ok to edit the original theme.css?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Wed, 2009-09-30 22:17

gallery does not look for css in local directories.
Ok to edit the original, but make a backup.

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
afterdark

Joined: 2008-09-10
Posts: 56
Posted: Wed, 2009-09-30 22:47

Cool - have done that - it looks wicked. :)

Still can't get rid of the links at the top of the thumbnails though. :-/

When I specify:

$gallery->setConfig('login', false);
$gallery->setConfig('showSidebarBlocks', false);

...when not logged in I can still see gallery title ('Gallery') and 'Sidebar' (which is still a link but doesn't work). Those lines are only hiding the Login button. See:
http://www.afterdarkmodels.com/gallery/gallery2Embedded.php

Any suggestions?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2009-10-01 00:12

the 'Gallery' is the album title, edit album -> title
if the login button is still present, you must not be calling $gallery->setConfig('login', false); before handleRequest()
to remove/hide system links, try hiding them via css:

.gbSystemLinks{display:none;}

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
afterdark

Joined: 2008-09-10
Posts: 56
Posted: Mon, 2009-10-19 18:42

my ('login', false) line was definately before the handlerequest(), but I've managed to solve it another way by hiding the whole gsNavBar and gsbreadCrumb divs to anyone not logged in, using the code from this post:

http://gallery.menalto.com/node/42763#comment-162621

:)

This is just what I wanted, so admin can still navigate around to upload and move things about within the album, but no one else sees the links.

So I got it looking pretty much how I want it now, just gotta put pop lightbox on the front. Thanks for all your help Suprsidr.

Oh, one last question - once lightbox is installed I intend to rename the gallery2embedd.php file to something more visitor friendly like gallery.php. Is this likely to mess anything up - I can't remember if gallery2embedd.php is hard coded in to any of the many files I've been tinkering with along the way?

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2009-10-19 21:26
afterdark wrote:
I intend to rename the gallery2embedd.php file to something more visitor friendly like gallery.php. Is this likely to mess anything up - I can't remember if gallery2embedd.php is hard coded in to any of the many files I've been tinkering with along the way?

just make sure you change the name in your init()

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2