how to have a 'featured photo' on another page.

beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Tue, 2003-06-03 10:10

Hmm... I'm afraid this question is out of my league.
Are PHP pages even callable via IFRAMEs?
You might want to ask the folks in the random block forum... but I'm afraid I don't know enough to answer this one.

-Beckett (

)

 
Gaile

Joined: 2002-07-20
Posts: 1301
Posted: Tue, 2003-06-03 20:17

Marie,

Why are you even using an iframe there? You have the iframe inside a table cell - why not just use the featured photo code inside the table cell instead of inside an iframe being called into the table? Your iframe is set for no scroll, so it's not like you wanted people to be able to scroll for a larger photo.

I'm confused as to the logic of using the iframe there...but then I am often confused... :-?

 
fuzioneer

Joined: 2003-07-01
Posts: 7
Posted: Tue, 2003-07-01 18:24

i have installed your mod and it is working in a fashion !!!

i can go into gallery and select a featured photo, that photo gets displayed on my front page but i also get an error message as follows:-

"
Warning: Invalid argument supplied for foreach() in /home2/consulta/public_html/roundtheworld/modules/gallery/session.php on line 55
"

Line 55 of session.php as follows:-
foreach($HTTP_SESSION_VARS as $key => $value) {

URL of site is www.davidburley.com/roundtheworld/
featured photo is supposed to be displayed on bottom right in block, but it isnt (Anyone done this with phpnuke ???)

 
tomken

Joined: 2003-07-12
Posts: 1
Posted: Sat, 2003-07-12 18:55

Hello...... Does anyone think that it would be possible to include more than one feature photo? I run a website for a band and would like to feature 3-5 photos from our last show on our homepage. I am doing it now by hardcoding it with straight html. Is there anyway I could make this easier with php?

My website is http://staticblu.com

 
tenaki

Joined: 2003-04-08
Posts: 106
Posted: Tue, 2003-07-22 12:10

Hi I am trying to install this but get the following error

Parse error: parse error, unexpected $ in /home/********/public_html/classifieds/featured-photo.php on line 90

Any clues please

 
jokorn

Joined: 2003-02-23
Posts: 2
Posted: Tue, 2003-07-22 17:34

:D
I found that I could use the path to show a picture on my home page like /gallery/albums/albumName/Picture.thumb.jpg. I then linked that to the gallery of the thumb nails. Have a look at
[url]www.photosbyjack.com[/url]
Let me know if this helps.

 
tenaki

Joined: 2003-04-08
Posts: 106
Posted: Tue, 2003-07-22 20:36

Thanks fot the reply, I want to update the pic daily so the featured photo would be ideal

 
slimis

Joined: 2003-07-23
Posts: 9
Posted: Wed, 2003-07-23 03:30

Hello all!
I'm trying to get this going, I have the nessesary changes to view_album.php in place and I uploaded the following as featured-photo.php. When I however go to add a photo with the drop down, After I choose it I get this error:

Parse error: parse error in /xxxx/xxxx/xxxx/gallery/featured-photo.php on line 27

This is the correct path to the file, I have removed all trailing spaces
and I cant find the missing or added piece that is causing this error..
Any help will be greatfully accepted!!!
TIA
Here's the code

<?php
/*
* Featured photo block for Gallery
* Beckett Madden-Woods (beckett@beckettmw.com)
*
* This is basically block-random.php from Gallery
* Original author and copyright:
*
* Gallery - a web based photo album viewer and editor
* Copyright (C) 2000-2001 Bharat Mediratta
*
* Find the original GNU GPL license at http://gallery.sourceforge.net/
*/

/* Hack prevention. */
if (!empty($HTTP_GET_VARS["GALLERY_BASEDIR"]) ||
		!empty($HTTP_POST_VARS["GALLERY_BASEDIR"]) ||
		!empty($HTTP_COOKIE_VARS["GALLERY_BASEDIR"])) {
	print "Security violation\n";
	exit;
}

/* edit this if necessary, but include the trailing slash! */
$GALLERY_BASEDIR = "${DOCUMENT_ROOT}/gallery/";

if ($set) {
    require($GALLERY_BASEDIR . "init.php");
    define(FEATURE_CACHE, $gallery->app->albumDir . "/featured-photo.cache");
?>
    <html>
    <head>
       <title>Highlight Photo</title>
       <?php echo getStyleSheetLink() ?>
    </head>
    <body>
    <center>
<?php       

    if ($gallery->session->albumName && isset($index)) {
        if ($fd = fs_fopen(FEATURE_CACHE, "w")) {
            fwrite($fd, $gallery->session->albumName . "/$index");
            fclose($fd);
            print "New featured photo saved.\n</html>";
        }
        else {
            print "<span class=\"error\">Error: Could not open cache file"
                    . "</span>\n";
        }
    }
    else {
        print "<span class=\"error\">Error: Invalid parameters.</span>\n";
    }
    print "<br /><br /><form>\n";
    print "<input type=\"submit\" value=\"Close\" onclick='parent.close()'>\n";
    print "</form>\n";
    print "</html>";
    exit;
}
else {
    require($GALLERY_BASEDIR . "init.php");
    define(FEATURE_CACHE, $gallery->app->albumDir . "/featured-photo.cache");
    /* read in from cache file */
    if ($fd = fs_fopen(FEATURE_CACHE, "r")) {
        while ($line = fgets($fd, 4096)) {
            list($albumName, $index) = explode("/", $line);
        }
        fclose($fd);
    }
   
    if ($albumName) {
        $album = new Album();
        $album->load($albumName);
    }
    if ($album && $index) {
        $id = $album->getPhotoId($index);
        $PHOTO_URL = makeAlbumURL($album->fields["name"], $id);
        $ALBUM_URL = makeAlbumURL($album->fields["name"]);
        $IMG = "<a href=\"$PHOTO_URL\">" . $album->getThumbnailTag($index) . "</a>";
        $CAPTION = $album->getCaption($index);
        $FROM = "From: <a href=\"$ALBUM_URL\">" . $album->fields["title"] . "</a>";
       
        print "<div id=\"photoheader\">\n";
        print "<b>Featured Photo</b>\n";
        print "</div>\n\n";
       
        print "<div id=\"photo\">\n";
        print "$IMG\n";
        print "</div>\n\n";
       
        print "<div id=\"caption\">\n";
        print "$CAPTION<br />\n";
        print "$FROM\n";
        print "</div>\n";
    }
    else {
        print "<div id=\"feature_caption\">\n";
        print "No featured photo.\n";
        print "</div>\n";
    }
}

?>
 
Addict

Joined: 2003-07-23
Posts: 27
Posted: Thu, 2003-07-24 01:26

Ignore this post...

 
Addict

Joined: 2003-07-23
Posts: 27
Posted: Thu, 2003-07-24 02:06
fuzioneer wrote:
i have installed your mod and it is working in a fashion !!!

i can go into gallery and select a featured photo, that photo gets displayed on my front page but i also get an error message as follows:-

"
Warning: Invalid argument supplied for foreach() in /home2/consulta/public_html/roundtheworld/modules/gallery/session.php on line 55
"

Line 55 of session.php as follows:-
foreach($HTTP_SESSION_VARS as $key => $value) {

URL of site is www.davidburley.com/roundtheworld/
featured photo is supposed to be displayed on bottom right in block, but it isnt (Anyone done this with phpnuke ???)

I get the same on PostNuke. I've not looked into the cause though.

I'll check it out tomorrow if beckett doesn't beat me to it. :wink:

 
Addict

Joined: 2003-07-23
Posts: 27
Posted: Thu, 2003-07-24 23:45

Here's the fix. Edit featured-photo.php accordingly.
Start line 23 (original below).

/* edit this if necessary, but include the trailing slash! */ 
$GALLERY_BASEDIR = "modules/gallery/";

Should be modified to include global variables for Gallery. Replace the code posted above with the code below

    global $GALLERY_NO_SESSIONS;
    global $GALLERY_BASEDIR;
    global $GALLERY_EMBEDDED_INSIDE;
    global $GALLERY_MODULENAME;
    global $op;
    global $mop;
    global $include;
    global $name;

    $GALLERY_MODULENAME = "gallerymodulename"; //Whatever you called your module
    $GALLERY_BASEDIR = "modules/$GALLERY_MODULENAME/";
    $GALLERY_EMBEDDED_INSIDE = "nuke";
    $GALLERY_NO_SESSIONS = true;

This should resolve the session issue. Hope that helps.....
*EDIT*
I should also add that this will correct the link on the picture so that it displays within your 'Nuke site as a module rather than as a seperate entity.
*EDIT*

I used the Core/php block for PostNuke. That's the easiest way to utilize this code. Just paste the following in the content area:

include("modules/gallerymodulename/featured-photo.php");

Replace the 'gallerymodulename with your gallery module's name.

beckett, great start on this feature.:D I'm working to add a few things to it. I'll post them as I get them done if anyone is interested.

 
mib

Joined: 2003-04-26
Posts: 22
Posted: Sun, 2003-07-27 14:17

I was looking for a possibility to resize the featured photo.

This is my idea...

<?php
/*
 *
 * Different photo size and place for featured photo
 * Michael Baehni  approx. media
 *
 * Based on
 *
 * Featured photo block for Gallery
 * Beckett Madden-Woods (beckett@beckettmw.com)
 *
 * This is basically block-random.php from Gallery
 * Original author and copyright:
 *
 * Gallery - a web based photo album viewer and editor
 * Copyright (C) 2000-2001 Bharat Mediratta
 *
 * Find the original GNU GPL license at http://gallery.sourceforge.net/
 */

/* Hack prevention. */
if (!empty($HTTP_GET_VARS["GALLERY_BASEDIR"]) ||
    !empty($HTTP_POST_VARS["GALLERY_BASEDIR"]) ||
    !empty($HTTP_COOKIE_VARS["GALLERY_BASEDIR"])) {
    print "Security violation\n";
    exit;
}

/* edit this if necessary, but include the trailing slash! */
$GALLERY_BASEDIR =  "/opt/root/home/.../public_html/gallery/";
$dest = "/opt/root/home/.../public_html/imx/";
$source = "/opt/root/home/.../fotos/";
$pix ="titelbild.jpg";
$size = 350;

if ($set) {
 require($GALLERY_BASEDIR . "init.php");
    define(FEATURE_CACHE, $gallery->app->albumDir . "/featured-photo.cache");
?>
    <html>
    <head>
       <title>Highlight Photo</title>
       <?php echo getStyleSheetLink() ?>
    </head>
    <body>
    <center>
<?php	     

    if ($gallery->session->albumName && isset($index)) {
	if ($fd = fs_fopen(FEATURE_CACHE, "w")) {
	    fwrite($fd, $gallery->session->albumName . "/$index");
	    fclose($fd);
	    $albumName = $gallery->session->albumName;

	        if ($albumName) {
				$album = new Album();
				$album->load($albumName);
   			 }
	   	$photo= $album->getPhotoPath($index);
		$photo = substr (strrchr ($photo, '='), 1 ); 
		$res = resize_image($source.$photo,$dest.$pix, $size);
	    print "New featured photo resized and saved.\n</html>";
	}
	else {
	    print "<span class=\"error\">Error: Could not open cache file"
		    . "</span>\n";
	}
    }
    else {
	print "<span class=\"error\">Error: Invalid parameters.</span>\n";
    }
    print "<br /><br /><form>\n";
    print "<input type=\"submit\" value=\"Close\" onclick='parent.close()'>\n";
    print "</form>\n";
    print "</html>";
    exit;
}
else {
    require($GALLERY_BASEDIR . "init.php");
    define(FEATURE_CACHE, $gallery->app->albumDir . "/featured-photo.cache");
    /* read in from cache file */
    if ($fd = fs_fopen(FEATURE_CACHE, "r")) {
	while ($line = fgets($fd, 4096)) {
	    list($albumName, $index) = explode("/", $line);
	}
	fclose($fd);
    }
    
    if ($albumName) {
	$album = new Album();
	$album->load($albumName);
    }
	$id = $album->getPhotoId($index);
	$PHOTO_URL = makeAlbumURL($album->fields["name"], $id);
	$ALBUM_URL = makeAlbumURL($album->fields["name"]);
	$CAPTION = $album->getCaption($index);
	$FROM = "From: <a href=\"$ALBUM_URL\">" . $album->fields["title"] . "</a>";
	
}

?>
 
jhuber

Joined: 2003-07-11
Posts: 3
Posted: Sun, 2003-07-27 17:59

Anyone else getting the wrong photo. Some photos work and one in particular doesn't. Choosing featured photo writes the wrong photo to cache. The gallery is really small right now.

More Info: The position number is correct just album name incorrect.

More Info 2: It happens when a I choose a photo in an album that has nested albums.

 
jhuber

Joined: 2003-07-11
Posts: 3
Posted: Sun, 2003-07-27 21:37

I think I fixed it. I changed the the way the album name is set in view_album.php

It was:

Quote:
/* Joe Block for Pic o Day */
if ($gallery->user->isAdmin() && !strcmp($label, "Photo")) {
showChoice("Feature Photo", "featured-photo.php",
array("set" => 1,
"set_albumName" => $myAlbum->fields["name"],
"index" => $i));
}

Now:

Quote:
/* Joe Block for Pic o Day */
if ($gallery->user->isAdmin() && !strcmp($label, "Photo")) {
showChoice("Feature Photo", "featured-photo.php",
array("set" => 1,
"set_albumName" => $gallery->album->isAlbumName($index),
"index" => $i));
}

I don't know PHP or much of any another language for that matter. So, if I did something that is going to break or flat wrong let me know.

 
thominendicott
thominendicott's picture

Joined: 2003-07-28
Posts: 4
Posted: Mon, 2003-07-28 20:02

Beckett - that is AWESOME. I'll have to try that out myself.

 
mib

Joined: 2003-04-26
Posts: 22
Posted: Fri, 2003-08-01 07:33

Just try to resize the image with the resize function and copy it to another place.

pbyjp wrote:
YEP!! I finally got it. :lol:
I managed to work out 2 ways to rescale the featured photo.
one of them is fully integrated to featured photo, the other one is fully INSPIRED by featured photo.
as always, there are probably many ways to do it another way or to customize the following script.
Please play with it, adapt the html to your own needs and if you have questions, well, we ll try to answer them.
I wanted to have my featured photo on my website's front page. and I wanted it bigger than the thumbnail's size in my albums. I actually use the featured photo script as a "latest picture uploaded" workaround.

/* edit this if necessary, but include the trailing slash! */ 
 $GALLERY_BASEDIR =  "/opt/root/home/.../public_html/gallery/"; 
 $dest = "/opt/root/home/.../public_html/imx/"; 
 $source = "/opt/root/home/.../fotos/"; 
 $pix ="titelbild.jpg"; 
 $size = 350; 
  
 if ($set) { 
  require($GALLERY_BASEDIR . "init.php"); 
     define(FEATURE_CACHE, $gallery->app->albumDir . "/featured-photo.cache"); 
 ?> 
     <html> 
     <head> 
        <title>Highlight Photo</title> 
        <?php echo getStyleSheetLink() ?> 
     </head> 
     <body> 
     <center> 
 <?php         
  
     if ($gallery->session->albumName && isset($index)) { 
    if ($fd = fs_fopen(FEATURE_CACHE, "w")) { 
        fwrite($fd, $gallery->session->albumName . "/$index"); 
        fclose($fd); 
        $albumName = $gallery->session->albumName; 
  
            if ($albumName) { 
             $album = new Album(); 
             $album->load($albumName); 
              } 
          $photo= $album->getPhotoPath($index); 
       $photo = substr (strrchr ($photo, '='), 1 );  
       $res = resize_image($source.$photo,$dest.$pix, $size); 
        print "New featured photo resized and saved.\n</html>"; 
 
zchoice

Joined: 2003-07-26
Posts: 31
Posted: Tue, 2003-09-09 06:23

I tried this but no luck. What might I be missing?
I downloaded the featured-photo.php file and put it in my main gallery diretory, edited the variable fo my BASE_DIR, etc.
The Feauture Photo admin dropdown appears fie but when I select it I get a popup window displaying an error on line 87 in featured-photo.php.
Any help is greatly appreciated. I know this thread is old but what ight I be missing?

 
bubonic

Joined: 2003-09-07
Posts: 10
Posted: Tue, 2003-09-09 09:19

I keep getting 'Parse error: parse error in /home/httpd/htdocs/gallery/featured-photo.php on line 84'
and line 84 is the end of the file, it's nothing there.
I get the same error when I try to select a Feature photo', logged into my gallery.

This is really a nice feature, hope I can get some help.

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Fri, 2003-09-12 10:16

OKAY! Here this! This thread's gotten too long and confusing.
zchoice, bubonic, I'm no longer sure whether you're talking about a vanilla install, or with the "resizing" mods mentioned above.

For anyone with issues regarding featured_photo, OR with mods, etc., PLEASE post a new topic, and include "featured_photo" somewhere in the topic.

I'm locking this topic now, as it's too unwieldy to follow.

-Beckett (

)

 
beckett
beckett's picture

Joined: 2002-08-16
Posts: 3474
Posted: Tue, 2004-10-05 01:36

NEW VERSION UPDATED FOR v1.4.4 AND NEWER

I've updated the code after two years to work with some newer versions.
Grab it at:
http://beckettmw.com/downloads/featured-photo/

-Beckett (

)