Posted: Mon Nov 22, 2004 9:47 am Post subject: Help with Random Photo block
Get this information from the PHP diagnostic (in the configuration wizard).
Gallery URL (optional but very useful):www.dwarf.it/gallery
Gallery version:1.4.4 pl4
Graphics Toolkit: GD 2.0
Operating system: Linux
Web browser/version (if applicable): Explorer
Error: Requested index [0] out of bounds [3]
Fatal error: Call to a member function on a non-object in /web/htdocs/www.dwarf.it/home/modules/gallery/classes/Album.php on line 1258
sometimes the new random image block 2.0 gives me this error, not everytime just sometimes when I load up the page I found this thing written, I'm using the NG-Random Photo block V2.0, but it gave me the same problem with the older version.
Can you help?
I don't want much I just want a block that shows scrolling images from my gallery.
Joined: Mar 29, 2003 Posts: 1038 Location: Cambs,UK
Posted: Mon Nov 22, 2004 11:41 am Post subject: Re: Help with Random Photo block
Try deleting the file block.random-cache in your ALBUMS folder, then refresh the page _________________ "The only difference between me and a madman is that I'm not mad."
Joined: Mar 29, 2003 Posts: 1038 Location: Cambs,UK
Posted: Mon Nov 22, 2004 4:01 pm Post subject: Re: Help with Random Photo block
Plz POST your config lines from the BLOCK files.
EXAMPLE:
Code: ›
/*******************************************************************/
/* Full path to your Gallery, don't forget the trailing / */
/*******************************************************************/
$GALLERY_BASEDIR = "/home/httpd/phpnuke.nukedgallery.net/htdocs/modules/gallery/";
/*******************************************************************/
/* The module name of your Gallery, default is "gallery" */
/*******************************************************************/
$GALLERY_MODULENAME = "gallery";
/*******************************************************************/
/* Time, in seconds, to refresh random photo cache. Default is */
/* 86400 (check it daily) */
/*******************************************************************/
define(CACHE_EXPIRED, 10);
/*******************************************************************/
/* Full path to your albums directory, don't forget the trailing / */
/*******************************************************************/
define(ALBUM_DIRECTORY,"/home/httpd/phpnuke.nukedgallery.net/htdocs/albums/");
_________________ "The only difference between me and a madman is that I'm not mad."
Posted: Mon Nov 22, 2004 5:11 pm Post subject: Re: Help with Random Photo block
Code: › <?php
/*
* 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; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Developed by Dariush Molavi at NukedGallery.net
* Version 2.0
* 11 December 2003
*/
if (eregi("block-NG-RandomPhoto.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
global $gallery, $Version_Num;
require_once("NG-RandomPhoto_functions.php");
/*******************************************************************/
/* Valid values for $selector: "DAILY", "HOURLY", "RANDOM", "AUTO" */
/* DAILY, HOURLY show a new photo each day/hour */
/* RANDOM shows a new photo with each reload of the page */
/* AUTO refreshes just the block with a new random photo */
/*******************************************************************/
$selector = "RANDOM";
/*******************************************************************/
/* Number of seconds between autorefresh of block, valid only for */
/* $selector = AUTO */
/*******************************************************************/
$auto_rate = 5;
/*******************************************************************/
/* Number of photos to display, valid only for $selector = RANDOM */
/*******************************************************************/
$number_of_pix = 5;
/*******************************************************************/
/* Show photos horozontally(1) or vertically(0). Valid only for */
/* $selector = RANDOM */
/*******************************************************************/
$horozontal = 0;
/*******************************************************************/
/* Size of thumbnail. Leave at 0 to use Gallery default */
/*******************************************************************/
$scaleTo = 0;
/*******************************************************************/
/* Scrolling photos, valid only for $selector = RANDOM */
/*******************************************************************/
$scroll = 1;
Joined: Mar 29, 2003 Posts: 1038 Location: Cambs,UK
Posted: Mon Nov 22, 2004 5:20 pm Post subject: Re: Help with Random Photo block
You need to POST the CONFIG lines from your NG-RandomPhoto_functions.php _________________ "The only difference between me and a madman is that I'm not mad."
Posted: Fri Nov 26, 2004 1:34 pm Post subject: Re: Help with Random Photo block
ok that's the problem, I didn't configure right the random photo functions, now I have another problem as fast as I configure it like this:
Code: › <?php
/*
* 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; either version 2 of the License, or (at
* your option) any later version.
*
* This program is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* Developed by Dariush Molavi at NukedGallery.net
* Version 2.0
* 13 December 2003
*/
if (eregi("block-NG-RandomPhoto_functions.php",$_SERVER['PHP_SELF'])) {
Header("Location: index.php");
die();
}
global $gallery, $GALLERY_EMBEDDED_INSIDE, $GALLERY_EMBEDDED_INSIDE_TYPE, $GALLERY_MODULENAME, $Version_Num;
/*******************************************************************/
/* Full path to your Gallery, don't forget the trailing / */
/*******************************************************************/
$GALLERY_BASEDIR = "/web/htdocs/www.dwarf.it/home/modules/gallery/";
/*******************************************************************/
/* The module name of your Gallery, default is "gallery" */
/*******************************************************************/
$GALLERY_MODULENAME = "gallery";
/*******************************************************************/
/* Time, in seconds, to refresh random photo cache. Default is */
/* 86400 (check it daily) */
/*******************************************************************/
define(CACHE_EXPIRED, 10);
/*******************************************************************/
/* Full path to your albums directory, don't forget the trailing / */
/*******************************************************************/
define(ALBUM_DIRECTORY,"/web/htdocs/www.dwarf.it/home/albums/");
/*******************************************************************/
/* STOP!! DO NOT EDIT ANYTHING BELOW THIS POINT */
/*******************************************************************/
define(CACHE_FILE, ALBUM_DIRECTORY."block-random.cache");
function createBlockContent($album,$index,$scale,$auto=0) {
global $gallery, $GALLERY_EMBEDDED_INSIDE, $GALLERY_EMBEDDED_INSIDE_TYPE, $GALLERY_MODULENAME;
function get_random_photo_id(){
/* Initializing the seed */
srand ((double) microtime() * 1000000);
// Check the cache file to see if it's up to date
$rebuild = 0;
if (fs_file_exists(CACHE_FILE)) {
$stat = fs_stat(CACHE_FILE);
$mtime = $stat[9];
if ((time() - $mtime) > CACHE_EXPIRED) {
$rebuild = 1;
}
}
else {
$rebuild = 1;
}
if ($rebuild) {
scanalbums();
savecache();
}
else {
readcache();
}
$album = choosealbum();
if ($album) {
$index = choosephoto($album);
}
return array($album,$index);
}
function savecache() {
global $cache;
$fd = fopen(CACHE_FILE, "w");
foreach ($cache as $key => $val) {
fwrite($fd, "$key/$val\n");
}
fclose($fd);
}
function readcache() {
global $cache;
if ($fd = fs_fopen(CACHE_FILE, "r")) {
while ($line = fgets($fd, 4096)) {
list($key, $val) = explode("/", $line);
$cache[$key] = $val;
}
fclose($fd);
}
}
function choosephoto($album) {
global $cache, $gallery;
Joined: Mar 29, 2003 Posts: 1038 Location: Cambs,UK
Posted: Fri Nov 26, 2004 2:11 pm Post subject: Re: Help with Random Photo block
Replace ALL refernces to isAlbumName() to getAlbumName() - do not DELETE it _________________ "The only difference between me and a madman is that I'm not mad."
Posted: Sat Nov 27, 2004 3:20 pm Post subject: Re: Help with Random Photo block
Error: Requested index [0] out of bounds [3]
Fatal error: Call to a member function on a non-object in /web/htdocs/www.dwarf.it/home/modules/gallery/classes/Album.php on line 1610
now it gives me this problem.....
sometimes...not everytime....
Joined: Mar 29, 2003 Posts: 1038 Location: Cambs,UK
Posted: Sat Nov 27, 2004 7:02 pm Post subject: Re: Help with Random Photo block
Try deleting the 'block-random.cache' file from your ALBUMS folder and re-fresh the page. _________________ "The only difference between me and a madman is that I'm not mad."
Posted: Tue Nov 30, 2004 4:52 am Post subject: Re: Help with Random Photo block
my server is aruba.it and anyway the problem is that it gives me that problem only "sometimes" not everytime and sometime the whole site starts flashing in and out (like now) it keeps reloading (only the mainpage where the block is with on one side this thing appearing :table width="100%" border="0" cellpadding=" and I have to take away the block and then after a while I can reactivate it with no problems
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum