Hi every PhpWebGallery users,
Random Picture is the first official MOD available for PhpWebGallery :D
Description : enables you to display a random picture from your PhpWebGallery picture database. Just place the file random.php where you want on your website and give the correct information about where to find files of PhpWebGallery. You can also use the content of file random.php and copy it into another PHP web page.
Downloads
- Saturday November 1st, 2003 : release 1.0.0 (for PhpWebGallery 1.3) [zip] [tar.gz]
- Saturday November 6th, 2004 : release 1.0.1 (tested with releases 1.3.1, 1.3.2, 1.3.3 and 1.3.4) [zip] [tar.gz]
Last edited by z0rglub (2004-11-06 15:28:19)
Offline
As Random picture is the first MOD for PhpWebGallery, I show you how is written the file install.txt (that you can find in the downloadable archive) for release 1.0.0 :
############################################################################## ## MOD Title: Random picture # ## MOD Author: z0rglub < pierrick@z0rglub.com > (Pierrick LE GALL) # ## http://www.z0rglub.com # ## MOD Description: Display a random picture of the PhpWebGallery database # ## outside the gallery # ## MOD Version: 1.0.0 (works with PhpWebGallery 1.3) # ## # ## Installation Level: easy # ## Installation Time: 5 Minutes # ## Files To Edit: random.php # ## Included Files: random.php # ############################################################################## ## MOD History: # ## # ## 2003-11-01 - Version 1.0.0 # ## - Initial Release :-) # ## # ############################################################################## # #-----[ COPY ]---------------------------------------------------------------- # copy random.php TO the directory you want on the same website as PhpWebGallery # #-----[ OPEN ]---------------------------------------------------------------- # random.php # #-----[ FIND ]---------------------------------------------------------------- # define( PREFIX_INCLUDE, '../../devel/' ); // relative path to your gallery # #-----[ IN-LINE FIND ]-------------------------------------------------------- # '../../devel/' # #-----[ IN-LINE REPLACE WITH ]------------------------------------------------ # examples : './gallery/', './phpwebgallery/', '../photos/' 'relative/path/to/my/gallery/' # #-----[ SAVE/CLOSE ALL FILES ]------------------------------------------------ # # EoM
This is just an example at the date of 1st of November, release 1.0.0. These instructions may change in next releases of the MOD
Offline
I have a bug :
Fatal error: Call to undefined function: database_connection() in /htdocs/www/random.php on line 25
It means that the path given is not correct. The function is in the included file and the included file depends on the path given.
Offline
I've got two questions about this MOD:
I would like to place a random picture of my gallery at the startpage of my website but it should be only one of the thumbnails. Does this MOD work with the big pictures or with the thumbs? 8-O
My website (include startpage, except gallery) is written in html. Is it possible to build in this random.php into the html-startpage? If not, what can I do? :oops:
Thanks
Offline
I modified the code to works with the version 1.3 :
<?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, '../../devel/' ); // 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.= '&image_id='.$row['id']; //------------------------------------------------------------- display picture echo '<a href="'.$thumb_link.'">'; echo '<img src="'.$thumb_url.'" alt="" style="border:none;" />'; echo '</a>'; ?>
Offline
My structure's :
. |- gallery | |- include | |- admin | |- ... | `- random.php `- index.php
in index.php:
include("gallery/random.php");
what PREFIX_INCLUDE i must set?
Vlad wrote:
what PREFIX_INCLUDE i must set?
./gallery/
Offline
z0rglub wrote:
Vlad wrote:
what PREFIX_INCLUDE i must set?
./gallery/
Thanks!
Fatal error: Cannot redeclare validate_mail_address() (previously declared in \include\functions_user.inc.php:7)
I can't get even a error to pop in
define( PREFIX_INCLUDE, '../../devel/' ); // relative path to your gallery
I have a folder called Galleries and with in that folder PHPWebGallery is were the galleries for PHPWebGallery is at so my prefix would be?
./Galleries/galleries/ ? is that right?
Last edited by Zudomon (2004-08-30 13:43:05)
Offline
Using the modified code Lilian supplied:
define( PREFIX_INCLUDE, './' );
Upload random.php to the same directory category.php occupies
Offline
I'm getting this message:
Warning: main(./gallery/include/functions.inc.php): failed to open stream: No such file or directory in /home/httpd/vhosts/wsudl.com/httpdocs/gallery/random.php on line 24
Warning: main(): Failed opening './gallery/include/functions.inc.php' for inclusion (include_path=''.'') in /home/httpd/vhosts/wsudl.com/httpdocs/gallery/random.php on line 24
Fatal error: Call to undefined function: database_connection() in /home/httpd/vhosts/wsudl.com/httpdocs/gallery/random.php on line 25
Can anyone help me?
http://www.wsudl.com/gallery/random.php
Thanks,
~Jon
correction... i changed it to ./ instead of ./gallery/
and now i'm getting this message:
Fatal error: Call to undefined function: get_all_restrictions() in /home/httpd/vhosts/wsudl.com/httpdocs/gallery/random.php on line 39
Help?
~Jon
JBlade00 wrote:
Fatal error: Call to undefined function: get_all_restrictions() in /home/httpd/vhosts/wsudl.com/httpdocs/gallery/random.php on line 39
I've created release 1.0.1 of this MOD to comply with releases 1.3.1 to 1.3.4. It should work (I've tested)
Offline