Announcement

#1 2004-08-29 13:15:33

Zudomon
Member
2004-06-28
24

Random.v1.0.0 Quesstion

Hi all I was trying out this new mod but getting a blank screen all the time. I did what the install text told me to do but I'm pt sure about a few things maybe you can help. First the code:

CODE:
<?php
/***************************************************************************
*                                 random.php                              *
*                            -------------------                          *
*   application   : PhpWebGallery 1.3 <http://phpwebgallery.net>          *
*   author        : Pierrick LE GALL <pierrick@z0rglub.com>               *
*                                                                         *
*   $Id: random.php,v 1.1.1.1 2003/11/01 10:31:53 z0rglub Exp $
*                                                                         *
***************************************************************************/

/***************************************************************************
*                                                                         *
*   This program is free software; you can redistribute it and/or modify  *
*   it under the terms of the GNU General Public License as published by  *
*   the Free Software Foundation;                                         *
*                                                                         *
***************************************************************************/

//--------------------------------------------------------------- configuration
define( PREFIX_INCLUDE, 'Galleries/galleries' ); // relative path to your gallery
define( USER_ID, 2 ); // 2 is the guest, 1 the webmaster
//-------------------------------------------------------------------- includes
include( PREFIX_INCLUDE.'include/functions.inc.php' );
database_connection();
//-------------------------------------------------- configuraiton informations
$query = 'SELECT prefix_thumbnail';
$query.= ' FROM '.PREFIX_TABLE.'config';
$query.= ';';
$row = mysql_fetch_array( mysql_query( $query ) );
$prefix_thumbnail = $row['prefix_thumbnail'];
//----------------------------------------------------------- user informations
$query = 'SELECT status,forbidden_categories';
$query.= ' FROM '.PREFIX_TABLE.'users';
$query.= ' WHERE id = '.USER_ID;
$query.= ';';
$row = mysql_fetch_array( mysql_query( $query ) );
$user_status = $row['status'];
$restricted_cats = $row['forbidden_categories'];
//------------------------------------------------------------- which picture ?
$query = 'SELECT id,file,storage_category_id,tn_ext,category_id';
$query.= ' FROM '.PREFIX_TABLE.'images';
$query.= ' LEFT JOIN '.PREFIX_TABLE.'image_category AS ic ON id = ic.image_id';
if ( count( $restricted_cats ) > 0 )
{
  $query.= ' WHERE category_id NOT IN (';
  $query.= $restricted_cats;
  $query.= ')';
}
$query.= ' ORDER BY RAND()';
$query.= ' LIMIT 0,1';
$query.= ';';

$result = mysql_query( $query );
$row = mysql_fetch_array( $result );

// create directory where the thumbnail can be found
$site_url = get_site_url( $row['storage_category_id'] );
if ( $site_url == './galleries/' ) $site_url = '../../../photos/galleries/';
$cat_directory = $site_url.get_local_dir( $row['storage_category_id'] );
// file to display
$file = get_filename_wo_extension( $row['file'] );
// URL of the thumbnail
$thumb_url = $cat_directory.'thumbnail/';
$thumb_url.= $prefix_thumbnail.$file.'.'.$row['tn_ext'];
// link to the gallery
$thumb_link = PREFIX_INCLUDE.'picture.php';
$thumb_link.= '?cat='.$row['category_id'];
$thumb_link.= '&amp;image_id='.$row['id'];
//------------------------------------------------------------- display picture
echo '<a href="'.$thumb_link.'">';
echo '<img src="'.$thumb_url.'" alt="" style="border:none;" />';
echo '</a>';
?>


The website is in my main root folder and the main path is Galleries/galleries to get to the galleris list on PHPWebGallery. But I see that the install text useds these.

#-----[ IN-LINE REPLACE WITH ]------------------------------------------------
# examples : './gallery/', './phpwebgallery/', '../photos/'
'relative/path/to/my/gallery/'

I put a dot in front of the path anad two more dotes as well but didn't get it to work at all. Does the does mean something because if they do I don't have a clue. I'm not sure if I install it right or least corrected it. Let know if I was doing this right or what I did wrong. Hey I trying to learn PHP ;)

I'm using the change version from here: http://forum.phpwebgallery.net/viewtopic.php?id=1380
That works with verion 1.3. This is my root set up.

index.php
|
|
|--Galleries
|     |
|     |-galleries
|           |
|           |-(a)Other folders by artist
|           |-(b)Other folders by artist..(etc)
|
random.php

Will there be a updated relase so that it will work with V. 3.0?

http://www.furry-muscle.org/random.php

Last edited by Zudomon (2004-08-29 13:35:04)

Offline

 

Board footer

Powered by FluxBB

github twitter newsletter Donate Piwigo.org © 2002-2024 · Contact