Need help!!! Struggling with website-integration / embedding. Only pictures for public.

RSR

Joined: 2007-05-01
Posts: 41
Posted: Fri, 2007-05-04 12:36

Hi there!

Integrating / embedding Gallery2 into my website is a hard nut to crack with sleepless nights; and at this moment Ive almost given it up :-(

This is the problem I'm still struggling with since a few days and giving me headaches:

1. I've installed and created Gallery2 album in my testdirectory, like this:
www.mysite.com/testdir/gallery2. The Gallery is working fine.

2. Now I want to copy and rename this to:

www.mysite.com/public/gallery2

to make it public and ..... only want to show images and no navigation/ menu bars (like login, register, etc.). Only albums / pictures are being shown.

3. Problems:
3.a. copying and renaming from "testdir" to "public" no effect => gallery2 empty (uhhhh???, WTF).

3.b. Still have no clue how to hide or remove navigation/ menu bars (like login, register, etc.) for the public.

PM: the original www.mysite.com/testdir/gallery2/main.php remains unchanged cause I (website-manager / owner) want to use it for the admin-process.

Summary:

I want to have two separate pages:

1. a non-public admin-page, www.mysite.com/testdir/gallery2/main.php, which contains gallery and all the navigation stuff and menu's, but is not public and only reserved for the site-manager for uploading and editing images, albums, etc.

2. a public-page, located at: www.mysite.com/public/gallery2 , which contains only the gallery and NO navigation/ menu bars (like login, register, etc.). The public can only view images and no uploading facilities, etc.

How and where to start and fix this problem, please.
Any help will be appreciated.

 
photoric

Joined: 2007-04-04
Posts: 25
Posted: Sun, 2007-05-06 20:22

I have been struggling for days, too, trying to embed g2 into my web site, so I am certainly no expert. However, your desire (as stated at the bottom of your posting) to have a non-public admin page and a public page with limited access is already built into g2 using the admin log in, isn't it? It sounds like you want to have two separate installations, but they would not be synchronized, according to my understanding.

There is a way of preventing people from looking on your site while you are updating or working with it. Look at FAQ 1.9 on this page: http://codex.gallery2.org/Gallery2:FAQ#How_do_I_prevent_users_from_accessing_my_site_during_maintenance_or_upgrades.3F

As for copying or moving g2 to a different folder, the copy or move feature of file manager at your web host site should accomplish this. If it is not, perhaps you could make the transfer through your ftp application, such as filezilla. If that doesn't work, could you download the entire g2 to your computer and then upload it again to the public_html folder on your web host site?

I have been trying to embed using the php file at this site: http://codex.gallery2.org/Gallery2:How_to_visually_embed_G2_in_your_own_website_using_embedded_mode

It says to "Next you will need to check the paths at the top of the file to make sure they are correct for your installation of gallery2 and the location of your gallery2embedded.php file." However, that is all it gives. I have searched the Internet and the g2 site and still can't figure out how to fill in the: embed path, g2uri, login Redirect and embed uri the php file requires, so I can't successfully embed it. Does anyone have an idea? Any help would be appreciated.

 
RSR

Joined: 2007-05-01
Posts: 41
Posted: Sun, 2007-05-06 22:15

Unfortunately we're not the only one struggling with instructions that's hard to understand for a newbie, amateur or non-expert.

I was also trying to embed using the instructions at http://codex.gallery2.org/Gallery2:How_to_visually_embed_G2_in_your_own_website_using_embedded_mode
but came not further than item 1. :-(

So can anyone give us clear instructions how to embed Gallery2 in a website???

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Sun, 2007-05-06 22:24

I created a simple embed page to get you started.
you'll find it here, it is commented throughout for simplicity.
-s
FlashYourWeb and Your Gallery

 
photoric

Joined: 2007-04-04
Posts: 25
Posted: Mon, 2007-05-07 03:33

Thanks for the help, RSR. I am embarrassed to appear so dense, but after days of working on this, I am beyond embarrassment and am obviously dense regarding this issue. I know that you feel your instructions in your file are in simple language, and I have considered editing your file, galleryindex.php, but I don't know where to start.

You said to consider editing lines 3 & 4, to reflect my site's setup,if needed. First a horribly elementary question: My file editor on my web site does not number the lines. How do you count them? Do you count the instruction lines, blank lines and lines giving commands or just some of them? Some editors must number them, I would think.

I have been trying for days to configure the php file from the g2 web site (http://codex.gallery2.org/Gallery2:How_to_visually_embed_G2_in_your_own_website_using_embedded_mode) which they have asked us to name gallery2embedded.php and which I placed in my gallery2 directory, as instructed. I have placed gallery 2 as follows: http://photorichards.com/public_html/gallery2

I have placed your file in the root directory of my web site /home/galleryindex.php

Here is how I have configured gallery2embedded.php, part of which file is shown below and is obviously incorrect:

<?php
$g2_Config['path'] = dirname(__FILE__) . '/photorichards.com/';

$g2_Config['embedPath'] = './gallery2/embed.php';
$g2_Config['g2Uri'] = '/gallery2/';
$g2_Config['loginRedirect'] = '/';
$g2_Config['embedUri'] = '/gallery2/gallery2embedded.php';

//print_r($g2_Config);
require_once( $g2_Config['path'] . 'embed.php');
if (!headers_sent()) {
header('Content-Type: text/html; charset=UTF-8');
}
$ret = GalleryEmbed::init(array(
'g2Uri' => $g2_Config['g2Uri'],
'loginRedirect' => $g2_Config['loginRedirect'],
'embedUri' => $g2_Config['embedUri'],
'fullInit' => 'false',
'apiVersion' => array(1,0)

Would you have any explicit, simple suggestions on how I should configure this file or your file to enable gallery2 to show up on my web site? I would be most appreciative.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2007-05-07 03:50

well, you did not place galleryindex.php in your site's root(http://photorichards.com), you placed it in http://photorichards.com/gallery2/
move it outside gallery2

you only need a simple text editor to edit this file, and lines are counted as lines, instructions and all.
you should not have to edit lines 3 & 4 if you move the file out of gallery2 to your site's root.

-s
FlashYourWeb and Your Gallery

 
photoric

Joined: 2007-04-04
Posts: 25
Posted: Mon, 2007-05-07 06:43

suprsidr:

Thanks for the prompt reply. I moved it to http://photorichards.com and still gallery2 doesn't show up on http://photorichards.com Any suggestions? I am at a loss.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Mon, 2007-05-07 11:14

although it does show http://www.photorichards.com/galleryindex.php
if you want this to be your default page, rename it to index.php, and change the one instance of /galleryindex.php? to /index.php? inside the script.
and then finish customizing it, adding your custom HTML where needed (header, body, footer) I've commented as to where they go in the script.

-s
FlashYourWeb and Your Gallery

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Mon, 2007-05-07 14:34

I've updated the wiki to hopefully help those that are having issues with understanding what the paths are supposed to be.

http://codex.gallery2.org/Gallery2:How_to_visually_embed_G2_in_your_own_website_using_embedded_mode

Steve Lineberry

 
photoric

Joined: 2007-04-04
Posts: 25
Posted: Tue, 2007-05-08 03:59

I really do appreciate the help, but, Guys, I am getting nowhere still. If I gave you my setup and the embedding file, could you just fill it out for me?

Here is my setup: website: http://www.photorichards. com (I have a nonsense test page set up on the website now)

Location of g2: / home / public_html / gallery2
It also gives me this: http://photorichards.com/gallery2

Location of my gallery2embedded.php file: / home / public_html / gallery2 / gallery2embedded.php
(suprsidr: I am working with this php file instead of the one you provided, because I couldn't get yours to work and didn't want just g2 to be my default page, which you suggested it would be with your file renamed. I wanted to be able to put other items on the web page, too. I do appreciate your help.)

This is the file I need to get configured. I can't get the top configured correctly with respect to the 'path' 'embedpath' 'g2Uri' 'loginRedirect' and 'embedUri' Knowing my setup, could you please configure them for me? I would really appreciate it. I've spent hours on this. Below this file is how I have it configured. Perhaps you could point out where I went wrong. Thanks a million.

<?php
$g2_Config['path'] = dirname(__FILE__) . '/';

$g2_Config['g2Uri'] = '/gallery2/';
$g2_Config['loginRedirect'] = '/';
$g2_Config['embedUri'] = '/gallery2/gallery2embedded.php';

//print_r($g2_Config);
require_once( $g2_Config['path'] . 'embed.php');
if (!headers_sent()) {
header('Content-Type: text/html; charset=UTF-8');
}
$ret = GalleryEmbed::init(array(
'g2Uri' => $g2_Config['g2Uri'],
'loginRedirect' => $g2_Config['loginRedirect'],
'embedUri' => $g2_Config['embedUri'],
'fullInit' => 'false',
'apiVersion' => array(1,0)
));
GalleryCapabilities::set('login',true);

// handle the G2 request
$g2moddata = GalleryEmbed::handleRequest();
// show error message if isDone is not defined
if (!isset($g2moddata['isDone']))
{
print 'isDone is not defined, something very bad must have happened.';
exit;
}
// die if it was a binary data (image) request
if ($g2moddata['isDone'])
{
exit; /* uploads module does this too */
}
if ($ret)
{
print $ret->getAsHtml();
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<?php
list($title, $css, $javascript) = GalleryEmbed::parseHead($g2moddata['headHtml']);
echo "<title>" . $title . " -- MySite</title>\n";

foreach ($css as $item) {
echo $item . "\n";
}
foreach ($javascript as $item) {
echo $item . "\n";
}
?>
<style type="text/css"> <!-- /*#gsHeader { display : none; } #gsFooter { display: none; }*/ --> </style>
</head>
<body class="gallery">
<?php
echo $g2moddata['bodyHtml'];
?>
</body>
</html>

(Below is my configuration of the top of the above file:)

<?php
$g2_Config['path'] = dirname(__FILE__) . '/photorichards.com/public_html/gallery2/';

$g2_Config['embedPath'] = '/gallery2/gallery2embedded.php';
$g2_Config['g2Uri'] = '/public_html/gallery2/';
$g2_Config['loginRedirect'] = '/';
$g2_Config['embedUri'] = '/gallery2embedded.php';

//print_r($g2_Config);
require_once( $g2_Config['path'] . 'embed.php');
if (!headers_sent()) {
header('Content-Type: text/html; charset=UTF-8');
}
$ret = GalleryEmbed::init(array(
'g2Uri' => $g2_Config['g2Uri'],
'loginRedirect' => $g2_Config['loginRedirect'],
'embedUri' => $g2_Config['embedUri'],
'fullInit' => 'false',
'apiVersion' => array(1,0)

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Tue, 2007-05-08 12:18

Ok, the first problem is that it's looking for the embed.php file at

/home/photoric/public_html/gallery2/photorichards.com/public_html/gallery2/embed.php

I assume this is the wrong path.

I beleive your error is here:

$g2_Config['path'] = dirname(__FILE__) . '/photorichards.com/public_html/gallery2/';

you either need to keep this as dirname(__FILE__) and keep your gallery2embedded.php file in your gallery2 directory or set it to the full path of your gallery2 directory.

this is needed because of this line

require_once( $g2_Config['path'] . 'embed.php');

This embed.php file is located in your gallery2 directory. If it can't find that file you're not going to get anything working.

Your other paths are messed up too I believe. Assuming your web root is your /home/public_html/ directory, try:

$g2_Config['g2Uri'] = '/gallery2/';
$g2_Config['embedUri'] = '/gallery2/gallery2embedded.php';

Steve Lineberry

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Tue, 2007-05-08 12:46

Steve, he is wanting this to be his site's default page, so you'll have to move it to his root, and rename it index.php, or have him change his root.

-s
FlashYourWeb and Your Gallery

 
photoric

Joined: 2007-04-04
Posts: 25
Posted: Tue, 2007-05-08 17:39

Steve, I configured gallery2embedded.php as you suggested above (see the configuration below), and g2 still does not show up on my web page http://photorichards.com, though the web page does show up.

supersidr, I may have left you with the wrong impression. I would like the web site home page to be the default page with g2 embedded in it, if I can get it configured. Otherwise, I would settle for g2 being the default on my web site.

I called startlogic, the web site provider, and asked the support person to look over my site for errors. He found a few minor ones and corrected them, but nothing major.

Are strange things happening? Steve, you had mentioned:

"Ok, the first problem is that it's looking for the embed.php file at

/home/photoric/public_html/gallery2/photorichards.com/public_html/gallery2/embed.php"

However, I didn't think I had that line typed into the gallery2embedded.php file, so I am wondering how that extra information got appended to the url. Also I tried to upload pictures to http://photorichards.com/main.php using gallery remote, and it said that "gallery was not found at that url" even though I had just seen it at that same url by going directly through Internet Explorer. I don't know if that information will help.

Anyway here is the configuration as I entered it trying to follow your suggestions, and thanks again for the help from both of you:

<?php
$g2_Config['path'] = dirname(__FILE__) . '/';

$g2_Config['embedPath'] = '/gallery2/gallery2embedded.php';
$g2_Config['g2Uri'] = '/gallery2/';
$g2_Config['loginRedirect'] = '/';
$g2_Config['embedUri'] = '/gallery2/gallery2embedded.php';

//print_r($g2_Config);
require_once( $g2_Config['path'] . 'embed.php');
if (!headers_sent()) {
header('Content-Type: text/html; charset=UTF-8');
}
$ret = GalleryEmbed::init(array(
'g2Uri' => $g2_Config['g2Uri'],
'loginRedirect' => $g2_Config['loginRedirect'],
'embedUri' => $g2_Config['embedUri'],
'fullInit' => 'false',
'apiVersion' => array(1,0)
));
GalleryCapabilities::set('login',true);

// handle the G2 request
$g2moddata = GalleryEmbed::handleRequest();
// show error message if isDone is not defined
if (!isset($g2moddata['isDone']))
{

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Tue, 2007-05-08 20:16
suprsidr wrote:
Steve, he is wanting this to be his site's default page, so you'll have to move it to his root, and rename it index.php, or have him change his root.

-s
FlashYourWeb and Your Gallery

Thanks, I was thinking he could do a redirect from the index.php to the gallery2embedded.php file

header("Location: /gallery2/gallery2embedded.php"); 

Steve Lineberry

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Tue, 2007-05-08 20:23

OK, so I went to http://photorichards.com/gallery2/gallery2embedded.php and it looked like your gallery2 is embedded and working properly.

I would create the index.php at /home/photoric/public_html/ with the code I have in the previous post in it. You will probably also have to delete or rename the index.html.

This all assumes you have index.php listed in your DirectoryIndex in the httpd.conf file.

Steve Lineberry

 
photoric

Joined: 2007-04-04
Posts: 25
Posted: Wed, 2007-05-09 04:46

Thanks for the advice. I have done as follows:

You said: "I would create the index.php at /home/photoric/public_html/ with the code I have in the previous post in it."
I did: I created the index.php file and put it in the /home/public_html/ folder. I am not sure why you said /home/photoric/public_html/ since the photoric and public_html folders are located on the same level within the home folder. Is that right or am I misinterpreting?

You said: "You will probably also have to delete or rename the index.html."
I did: I renamed the index.html file which is located within the public_html folder

I then tried to log into photorichards.com and this time, instead of getting the previous web page, I got the contents of the index.php file on the screen. It said: header("Location: /gallery2/gallery2embedded.php");

You mentioned: "This all assumes you have index.php listed in your DirectoryIndex in the httpd.conf file."

Does the fact that g2 did not show up on the web page mean that index.php is not listed in my DirectoryIndex in the httpd.conf file? I did some reading on that file. There was a warning at one discussion site that not just any text editor could be used (not notepad or MS Word), since they might append extra information to the file name. I am not sure what editor to use or how to use it or how to even access the file, httpd.conf. It seemed pretty straight forward to type that file name at the head of the directory index but there are warnings at a number of sites not to screw with this file, unless you know what you're doing, and always make a backup. It is no secret that I am in deep water, but I am willing to follow instructions. Any suggestions at this point? Thanks again for sticking with me. It feels like we're making progress.

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Wed, 2007-05-09 11:56

Did you put the php tags around it?

<?php
header("Location: /gallery2/gallery2embedded.php"); 
?>

Sorry I didn't include the php tags before, I thought you would know to do it.

Steve Lineberry

 
photoric

Joined: 2007-04-04
Posts: 25
Posted: Wed, 2007-05-09 15:24

It worked!! Just like the magic of seeing a print start to appear in the darkroom, g2 appeared when I went to my web site, and I have no one but you two guys to thank for it, certainly not myself. I am able to navigate throughout the web site and it is very quick. The only problem is that some of the images have become pixilated and some of the icons deliver the wrong picture, but I will deal with that by deleting and reinstalling the offending images.

Your history of helping people on the Internet with their problems is very impressive, on reviewing it on this web site. It is very comforting for the less knowlegable among us to be able to tap into this community of helpers. Thanks so much for your persistence and donation of your time and talent, Steve and suprsidr.

Carl Richards