Topic Title: [TESTING] Random Photo- Version 2.0

Forum Index » Blocks » [TESTING] Random Photo- Version 2.0
Topic URL: http://www.nukedgallery.net/postt497.html

AuthorMessage
Post Title: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Mon Dec 15, 2003 10:26 am
A totally rewritten random photo block is available for testing.
i have rewritten the block as follows:
- image size can be modified
- number of images (for random photo only) can be altered (can easily be tweaked for hourly/daily as well, if enough people request it).
- horozontal/vertical switch so block can be top/bottom center with multiple images laid out horozontally
- allows for marquee-style scrolling when in vertical orientation
- allows for auto-refresh (interval set by user); eliminates need to refresh entire page to see new random photo.

see it in action at http://phpnuke.nukedgallery.net

NOTE: because i want to retain the feature of using the one "core" block file to allow for multiple random/hourly/daily blocks on a site, the "support" file is now a functions file that gets put in the blocks directory. no need to touch/tweak that at all. this functions file has been extensively rewritten (allows other extensions besides jpg) and is much cleaner. also, the auto-refresh feature makes use of an IFRAME, which requires an additional file. The total package is now three files:
- <nuke>/blocks/block-NG-Random.php
- <nuke>/blocks/block-NG-Random_functions.php
- <nuke>/block-NG-AutoPhoto.php

See the auto refresh in action on the demo site. If you have no desire to use the auto refresh feature, then you don't need the AutoPhoto.php. If there are any other requests, please let me know and I'll try to add them in before a release.

http://www.nukedgallery.net/download-file-30.html [nukedgallery.net]

AuthorMessage
Post Title:
darkknight
Joined: Aug 21, 2003
Posts: 54

Posted: Mon Dec 15, 2003 10:35 am
ok, so to continue from old old posts, does this random block only allow images that people have permissions to view? (id be happy with it just displaying images that only the public can view), but would like to know if it will display restricted albums...

AuthorMessage
Post Title:
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Mon Dec 15, 2003 10:36 am
yes, only images available to the EVERYBODY user are viewable. it's an easy tweak in the _functions file to get rid of that check (i believe it's in the scan function, just remove the check..).

AuthorMessage
Post Title:
darkknight
Joined: Aug 21, 2003
Posts: 54

Posted: Mon Dec 15, 2003 10:40 am
nope, thats fine the way it is. Thanks!

AuthorMessage
Post Title:
darkknight
Joined: Aug 21, 2003
Posts: 54

Posted: Mon Dec 15, 2003 10:47 am
im getting an intermittant error:
Warning: mysql_fetch_row(): supplied argument is not a valid MySQL result resource in /home/hosting/web/anton/www.strangeparty.com/fullgallery/classes/database/mysql/Database.php on line 37

any ideas on how to debug this.. the images display fine, but the occasional one doesnt open a real image when clicked on. Gives some gallery error

AuthorMessage
Post Title:
darkknight
Joined: Aug 21, 2003
Posts: 54

Posted: Mon Dec 15, 2003 10:48 am
funny, ive just noticed it seems to only happen if im logged in to nuke.... wierd

AuthorMessage
Post Title:
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Mon Dec 15, 2003 10:49 am
what setting (random, auto, etc)?

AuthorMessage
Post Title:
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Mon Dec 15, 2003 10:55 am
ok i got the same error...will try to debug later this afternoon.

AuthorMessage
Post Title:
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Mon Dec 15, 2003 11:43 am
ok, i know what the error is, why it's caused, and where it's coming from. i'm just having a helluva time getting rid of it...

AuthorMessage
Post Title:
darkknight
Joined: Aug 21, 2003
Posts: 54

Posted: Mon Dec 15, 2003 12:06 pm
remove the offending line of code.. it doesnt seem to work, yet the images seem to display even if it is broken...

AuthorMessage
Post Title:
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Mon Dec 15, 2003 3:47 pm
i've fixed it (i think...at least i don't get the error anymore).
in block-NG-RandomPhoto.php, change:
PHP: › <?php global $gallery?>

to
PHP: › <?php global $gallery,$Version_Num?>


i will update the download...

AuthorMessage
Post Title:
unknownid
Joined: Aug 21, 2003
Posts: 6

Posted: Mon Dec 15, 2003 6:23 pm
Cool! This worked great right off for me, and scrolling a set of 4 is awsome. I am still curious about removing the 'check' you speak of so that maybe I could make the block only viewable by loggedin and the block would use 'ALL' the photos in the galleries (no matter the permissions), or at least all the galleries with the permissions of loggedin?

Man, you guys are so cool. I am so happy to have this cool block on my site.


--Thanks

AuthorMessage
Post Title:
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Mon Dec 15, 2003 9:31 pm
in the _functions file, find the scanalbums function (it should be the last one).

try replacing it with this function:
PHP: › <?php function scanalbums() {
    global 
$cache;
    global 
$gallery;

    
$cache = array();
    
$albumDB = new AlbumDB();
    foreach (
$albumDB->albumList as $tmpAlbum) {
                        
$numPhotos $tmpAlbum->numPhotos(1);
                        
$name $tmpAlbum->fields["name"];
                        if (
$numPhotos 0) {
                                
$cache[$name] = $numPhotos;
                        }       
    }
?>


this should use all pictures in all albums (try it out, make all albums LOGGEDIN only, see if it works....that way, if the block is enabled only for registered users, you'll have no problems.

AuthorMessage
Post Title:
darkknight
Joined: Aug 21, 2003
Posts: 54

Posted: Tue Dec 16, 2003 7:07 am
out of interest.. is there a way to recursively set permissions on galleries? like all at once? cause that would be really useful

AuthorMessage
Post Title:
darkknight
Joined: Aug 21, 2003
Posts: 54

Posted: Tue Dec 16, 2003 7:10 am
The file to fix was actually the block-NG-RandomPhoto_funcionts.php, but yeah.. it seems to work!

AuthorMessage
Post Title:
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Tue Dec 16, 2003 7:59 am
Quote: › out of interest.. is there a way to recursively set permissions on galleries? like all at once? cause that would be really useful

i'm not aware of any way of doing that..might be an interesting hack to put together...

Quote: › The file to fix was actually the block-NG-RandomPhoto_funcionts.php, but yeah.. it seems to work!

yeah, by "_functions", i meant block-NG-RandomPhoto_functions.php...i just got lazy and didn't want to type out the whole thing.

AuthorMessage
Post Title:
darkknight
Joined: Aug 21, 2003
Posts: 54

Posted: Tue Dec 16, 2003 8:38 am
i dont suppose you know much about how gallery stores its information? i know its some sort off flat file db, but nothing more...

AuthorMessage
Post Title:
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Tue Dec 16, 2003 8:41 am
yeah, it's a flatfile db, usually albumdb.dat/album.dat for album info. there is a perl script floating around that bharat wrote that will de-serialize the file:
Code: ›
#!/usr/bin/env perl
#
use strict;
use Data::Dumper;
use Getopt::Long;

my $validate_only = 0;
GetOptions("validate-only+" => \$validate_only);

my %parse_func =
  ("O:" => \&parse_object,
   "a:" => \&parse_array,
   "s:" => \&parse_string,
   "i:" => \&parse_integer,
   "b:" => \&parse_integer,
   "N;" => \&parse_null);

# Slurp the stdin
undef $/;
my $data = <>;

my ($tree, $index) = &parse(0);
print "$index bytes parsed";

if ($validate_only) {
  print " -- valid\n";
} else {
  print "\n";
  $Data::Dumper::Indent = 1;
  print Dumper($tree);
}

sub parse {
  my $index = shift;

  my $type = substr($data, $index, 2);
  my $func = $parse_func{$type};
  if (!$func) {
    die "Unknown type '$type' at position $index";
  }
  &$func($index+2);
}

sub parse_object {
  my $index = shift;

  my $self = {};

  my ($name, $members);
  ($name, $index) = &get_string($index);
  $index = skip($index, ':');
  ($members, $index) = &parse_array($index);

  $self->{"$name (class)"} = $members;

  return ($self, $index);
}

sub parse_null {
  my $index = shift;

  return ("<null>", $index);
}

sub parse_integer {
  my $index = shift;

  my $value;
  my $self = {};
  ($value, $index) = get_number($index);
  $index = skip($index, ';');

  return ($value, $index);
}

sub parse_string {
  my $index = shift;

  my $value;
  my $size = 0;

  ($value, $index) = get_string($index);
  $index = skip($index, ';');

  return ($value, $index);
}

sub parse_array {
  my $index = shift;

  my $self = [];
  my $count = 0;
  ($count, $index) = get_number($index);
  $index = skip($index, ':{');
  for (my $i = 0; $i < $count; $i++) {
    my ($key, $value);
    ($key, $index) = &parse($index);
    ($value, $index) = &parse($index);
    push(@$self, { $key => $value });
  }
  $index = skip($index, '}');
  return ($self, $index);
}

sub get_string {
  my $index = shift;

  my $size;
  my $value;
  ($size, $index) = get_number($index);
  $index = skip($index, ':"');
  $value = substr($data, $index, $size);
  $index += $size;
  $index = skip($index, '"');

  return ($value, $index);
}

sub get_number {
  my $index = shift;

  my $ch;
  my $num = undef;
  while(($ch = substr($data, $index, 1)) =~ /\d/) {
    $index++;
    if (!defined($num)) {
      $num = 0;
    }
    $num = 10 * $num + int($ch);
  }

  if (!defined($num)) {
    die "Expected number at $index, found '$ch' instead\n";
  }

  return ($num, $index);
}


sub skip {
  my $index = shift;
  my $expected = shift;

  my $size = length($expected);
  my $actual = substr($data, $index, $size);
  if ($actual ne $expected) {
    die "Expected '$expected' at $index, found '$actual' instead\n";
    exit;
  }

  return $index + $size;
}

__END__
while(<>) {
  foreach $line (split(/([{\}])/)) {
    $indent -= ($line eq "}");
    next unless $line;
    $line =~ s/;/";\n" . "  " x $indent/ge;
    print "  " x $indent, "$line\n";
    $indent += ($line eq "{");
  }
}


run it as follows:
Code: › perl decode.pl <dbfile>


this will give you an easy to read output of the info in the db files...

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
unknownid
Joined: Aug 21, 2003
Posts: 6

Posted: Wed Dec 17, 2003 5:39 pm
Yes this worked great! Thanks again!

--

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
Stevo
Joined: Dec 13, 2003
Posts: 3

Posted: Wed Dec 17, 2003 7:22 pm
That is one awesome block. I got it running on my site just fine!! Love the 'slideshow' effect!!

AuthorMessage
Post Title: performance problem :(
efurban
Joined: Nov 01, 2003
Posts: 5

Posted: Thu Dec 18, 2003 3:22 am
Hi,

This is exactly what I'm looking for and I have it running perfectly on my site now.
There is only one small problem regarding to the performance, well, for me.

It seems that the loading (or generating) time of the page increases as the number of pics increases, when I use $scroll = 1;

e.g.,
$number_of_pix = 1; page generation: 1.5s
=3; page generation: 3 s
= 10; page generation: 11 s
I do understand why there is such a overhead, but , is there anything can be done to reduce the delay ?

my site: http://www.ouwu.com [ouwu.com] --> you can see the page generation time down the bottom.

Thank you very much.

Trav [/url]

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Thu Dec 18, 2003 8:00 am
this is to be expected...as each image loaded requires grabbing a new random image (reading the cache file, selecting an album, then selecting an image from the album). AFAIK, the only way to reduce the delay is to reduce the number of pictures. i keep mine to 5 or less...

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
er1k
Joined: Dec 18, 2003
Posts: 2

Posted: Thu Dec 18, 2003 6:09 pm
Hi, I'm using PHP 4.3.3, PHPNuke 6.9 and Gallery 1.4.1.

The embedded gallery works great but i'm having problems getting the new V2 Random Block to work.

I'm getting the following errors:

Warning: Invalid argument supplied for foreach() in /var/www/html/nuke/html/blocks/block-NG-RandomPhoto_functions.php on line 258

Fatal error: Call to a member function on a non-object in /var/www/html/nuke/html/blocks/block-NG-RandomPhoto_functions.php on line 66

I've verified all of the paths. It's a brand new Nuke and Gallery installation.

Any ideas?

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
er1k
Joined: Dec 18, 2003
Posts: 2

Posted: Fri Dec 19, 2003 12:27 am
I fixed it. I found the missing $Version_Num global in the _functions file. Works great now! The zip file should be updated Smile

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Fri Dec 19, 2003 8:01 am
hmmm..i thought i did update the zip file...
<goes to check>
the $version_num was in the block file, but not in the functions file....i added it and updated the download.

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
ElevenBravo
Joined: Dec 19, 2003
Posts: 2

Posted: Fri Dec 19, 2003 12:22 pm
This is the error I get.

Code: › Warning: Invalid argument supplied for foreach() in /home/ffxicom/public_html/blocks/block-NG-RandomPhoto_functions.php on line 258

Fatal error: Call to a member function on a non-object in /home/ffxicom/public_html/blocks/block-NG-RandomPhoto_functions.php on line 66


And I had to manully create a block-random.cache file and put it in my album directory.

BTW heres my global
Code: › global $gallery, $GALLERY_EMBEDDED_INSIDE, $GALLERY_EMBEDDED_INSIDE_TYPE, $GALLERY_MODULENAME,$Version_Num;

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
ElevenBravo
Joined: Dec 19, 2003
Posts: 2

Posted: Fri Dec 19, 2003 12:43 pm
OK got it working.

I had to change the cache timer to like 300, so it would start a new cache.

Works great now.

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
rioguia
Joined: Nov 16, 2003
Posts: 12

Posted: Sat Dec 20, 2003 12:44 am
i am attempting to install block-NG-RandomImproved.zip. i have successfully installed gallery-1.4.1 (great upgrade and great instructions) under gallery 6.9 on a redhat 9.0 server. I have attempted to follow the installation instructions for the random photo but each time i try to apply the block, all the content on my site disappears except for the error message quoted below. see www.substantis.com

REGARDING THE INSTRUCTIONS RELATED to the variables in the files called block-RandomPhoto.php and random_support.php file., i made the following edits according to the instructions:

Quote: › $GALLERY_BASEDIR ="/usr/local/apache2/2.0.47/htdocs/modules/gallery";
define(ALBUM_BASEADDR, "http://www.substantis.com/albums/");
define(SERVER_ADDR, "http://www.substantis.com/");


REGARDING THE INSTRUCTIONS ON RENAMING THE GALLERY VARIABLE:

$url .= "&op=modload&name=gallery&file=index&include=view_photo.php";

$albumURL .= "&op=modload&name=gallery&file=index&include=view_album.php";

I did not edit the bold values in the above lines in random_support.php to reflect the name of my gallery because the name of my isntallation is "gallery". therefore, i made no change (not sure if this is correct).

ERROR MESSAGES


define(CACHE_FILE, $gallery->app->albumDir."/block-random.cache");
define(ALBUM_BASEADDR, "http://www.substantis.com/albums/");
define(SERVER_ADDR, "http://www.substantis.com/");


Quote: › Warning: main(/usr/local/apache2/2.0.47/htdocs/modules/galleryrandom_support.php): failed to open stream: No such file or directory in /usr/local/apache2/2.0.47/htdocs/blocks/block-RandomPhoto.php on line 31

Fatal error: main(): Failed opening required '/usr/local/apache2/2.0.47/htdocs/modules/galleryrandom_support.php' (include_path='.:/usr/local/lib/php') in /usr/local/apache2/2.0.47/htdocs/blocks/block-RandomPhoto.php on line 31


the line 31 that the error message complains about is:
define(SERVER_ADDR, "http://www.substantis.com/");

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
C11
Joined: Dec 14, 2003
Posts: 3

Posted: Sat Dec 20, 2003 1:32 am
i only have one problem
when i renamed the album i kept getting a message

ERROR: requested index [] out of bounds [0]
Fatal error: Call to a member function on a non-object in /home/***/public_html/portal/modules/Gallery/classes/Album.php on line 1063

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
slackbladder
Joined: Mar 29, 2003
Posts: 1038
Location: Cambs,UK
Posted: Sat Dec 20, 2003 6:21 am
C11 wrote: › i only have one problem
when i renamed the album i kept getting a message

ERROR: requested index [] out of bounds [0]
Fatal error: Call to a member function on a non-object in /home/***/public_html/portal/modules/Gallery/classes/Album.php on line 1063


Delete your block-random.cache from your ALBUMS folder - then refresh your page that has the random block on it

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
slackbladder
Joined: Mar 29, 2003
Posts: 1038
Location: Cambs,UK
Posted: Sat Dec 20, 2003 6:26 am
Quote: › $GALLERY_BASEDIR ="/usr/local/apache2/2.0.47/htdocs/modules/gallery";


Try

Code: ›  $GALLERY_BASEDIR ="/usr/local/apache2/2.0.47/htdocs/modules/gallery/";


with a trailing slash after 'gallery/'

Also what is the code on line 31?

And put the block on the right - so it doesn't crash your site - like it does on the left

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
rioguia
Joined: Nov 16, 2003
Posts: 12

Posted: Sat Dec 20, 2003 8:40 am
thanks slackbladder. that was the solution (i was frantically looking for my post over the in wrong gallery forum to post it). sorry for the stupid error. now i'm working on the "foreach" error message. i'll try to post back with an intelliigent question if i can't figure it out. Wink

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
rioguia
Joined: Nov 16, 2003
Posts: 12

Posted: Sat Dec 20, 2003 11:23 pm
OK, i've made a mess of this. i was attempting to get rid of the error message related to foreach(). it seems my problem is with the session variables. the books i am reading about php seem to assume no backwards compatibility and perhaps this is the reason i don't understand the way the code for this function is written. the few times that backwards compatibility is addressed regarding registering session variables suggests that i should not try to use the $HTTP_SESSION_VARS or $_SESSION with the session-register( ) function. Is this the source of my problem? Anyway, here are the steps i have taken to solve this problem. Any suggestions would be appreciated.

following the directions, i modified the code to :
Quote: › if (!$gallery->register_globals) {
foreach($_HTTP_SESSION_VARS ==> $_SESSION) {
eval("\$$key = & \$HTTP_SESSION_VARS[\"$key\"];");


i now i have a different error message:
Quote: › Parse error: parse error in /usr/local/apache2/2.0.47/htdocs/modules/gallery/session.php on line 64


furthermore, when i select the random image, i get the following error message:
Quote: › Fatal error: Call to a member function on a non-object in /usr/local/apache2/2.0.47/htdocs/modules/gallery/view_photo.php on line 57


any help would be appreciated. thanks

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Sun Dec 21, 2003 2:45 pm
NukedGallery FAQ D.1. [nukedgallery.net]

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
jamesmc
Joined: Dec 19, 2003
Posts: 4
Location: Algarve, Portugal
Posted: Sun Dec 21, 2003 5:03 pm
Any idea why I am getting this??

Followed the instructions in readme.

Set up the blocks

Bang! now has the left set of blocks displayed in the centre of the window. At the bottom if the blocks is a block showing scrolling images.
Beneath that is the following error message:

Fatal error: Cannot redeclare createblockcontent() (previously declared in /home/rovworld/public_html/phpnuke/blocks/block-NG-RandomPhoto_functions.php:63) in /home/rovworld/public_html/phpnuke/blocks/block-NG-RandomPhoto_functions.php on line 63

Error can be seen at: http://www.rovworld.com/phpnuke/

Best regards
James Mc

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
jamesmc
Joined: Dec 19, 2003
Posts: 4
Location: Algarve, Portugal
Posted: Sun Dec 21, 2003 5:53 pm
And here I am again a few minutes later, answering my own question, with a red face Embarassed

It concerns the two files I installed in /blocks.
block-NG-RandomPhoto.php & block-NG-RandomPhoto_functions.php

I activated BOTH of them (in admin), as blocks without giving it a second thought!!
No reference in the readme file about that.... but no excuse either I reckon.

It seems, on reflection, I should only have activated block-NG-RandomPhoto.php in admin (phpNUKE 7.0).

Was I wrong? Well, I now have a block with vertical scrolling images which is exactly what I wanted in the first place.

Thanks Dari for putting in the work on this one!

Best regards
James Mc

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Sun Dec 21, 2003 9:29 pm
you got it....the _functions file is NOT activated...just the regular block file..

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
rioguia
Joined: Nov 16, 2003
Posts: 12

Posted: Sun Dec 21, 2003 10:05 pm
thanks. the faq was exactly what i needed. i was working off from the article at
http://www.nukedgallery.net/article8.html

this is a great feature. many thanks to the author for his/her hard work and the moderators for their patient suppott.

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
mwyner
Joined: Sep 05, 2003
Posts: 2

Posted: Fri Dec 26, 2003 7:34 pm
Great block!!! Couple problems though.

I have a few albums which are empty (they're placeholders), and the block tries to pull photos from said albums, so I get the "no highlight" message sometimes in the block because that's what Gallery says when there's an album without a picture. Can it be set up to ignore albums without any photos?

Also I'm using the block Random, 2 photos, and sometimes one of the 2 photos will show up in the block without a caption. There's nothing in the error log, and the pictures it happens to appear to be random.

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Mon Dec 29, 2003 8:45 am
hmm...i'll add in a check for the number of photos and only pull from albums with photos...

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Mon Dec 29, 2003 8:46 am
rioguia wrote: › i am attempting to install block-NG-RandomImproved.zip. i have successfully installed gallery-1.4.1 (great upgrade and great instructions) under gallery 6.9 on a redhat 9.0 server. I have attempted to follow the installation instructions for the random photo but each time i try to apply the block, all the content on my site disappears except for the error message quoted below. see www.substantis.com

REGARDING THE INSTRUCTIONS RELATED to the variables in the files called block-RandomPhoto.php and random_support.php file., i made the following edits according to the instructions:

Quote: › $GALLERY_BASEDIR ="/usr/local/apache2/2.0.47/htdocs/modules/gallery";
define(ALBUM_BASEADDR, "http://www.substantis.com/albums/");
define(SERVER_ADDR, "http://www.substantis.com/");


REGARDING THE INSTRUCTIONS ON RENAMING THE GALLERY VARIABLE:

$url .= "&op=modload&name=gallery&file=index&include=view_photo.php";

$albumURL .= "&op=modload&name=gallery&file=index&include=view_album.php";

I did not edit the bold values in the above lines in random_support.php to reflect the name of my gallery because the name of my isntallation is "gallery". therefore, i made no change (not sure if this is correct).

ERROR MESSAGES


define(CACHE_FILE, $gallery->app->albumDir."/block-random.cache");
define(ALBUM_BASEADDR, "http://www.substantis.com/albums/");
define(SERVER_ADDR, "http://www.substantis.com/");


Quote: › Warning: main(/usr/local/apache2/2.0.47/htdocs/modules/galleryrandom_support.php): failed to open stream: No such file or directory in /usr/local/apache2/2.0.47/htdocs/blocks/block-RandomPhoto.php on line 31

Fatal error: main(): Failed opening required '/usr/local/apache2/2.0.47/htdocs/modules/galleryrandom_support.php' (include_path='.:/usr/local/lib/php') in /usr/local/apache2/2.0.47/htdocs/blocks/block-RandomPhoto.php on line 31


the line 31 that the error message complains about is:
define(SERVER_ADDR, "http://www.substantis.com/");


Just an FYI: this thread is NOT for block-NG-RandomImproved...it's for block-NG-RandomPhotoV2.zip...

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
bbongyi
Joined: Dec 27, 2003
Posts: 11

Posted: Tue Dec 30, 2003 2:54 pm
I dont' know why...I just installed...and I got follwoing error messages in the random photo box..

Warning: fopen(C:\AppServ\www\PHPNuke\albums\block-random.cache): failed to open stream:
No such file or directory in C:\AppServ\www\PHPNuke\modules\gallery\platform\fs_win32.php on line 50

Warning: Invalid argument supplied for foreach() in c:\appserv\www\phpnuke\blocks\block-NG-RandomPhoto_functions.php on line 258

Fatal error: Call to a member function on a non-object in c:\appserv\www\phpnuke\blocks\block-NG-RandomPhoto_functions.php on line 66

I tried to find block-random.cache but I couldn't....what's wrong..?

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
pepbill
Joined: Dec 30, 2003
Posts: 2

Posted: Tue Dec 30, 2003 3:45 pm
Getting this error

Call to undefined function: fs_file_exists() in /Library/WebServer2/Documents/blocks/block-NG-RandomPhoto_functions.php on line 177

It seems it's relasted to teh cache file. I've created delted chmod 777 and no luck

PHP Version 4.3.2
PHPNuke 7.0
OSX server

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Tue Dec 30, 2003 3:52 pm
bbongyi wrote: › I dont' know why...I just installed...and I got follwoing error messages in the random photo box..

Warning: fopen(C:\AppServ\www\PHPNuke\albums\block-random.cache): failed to open stream:
No such file or directory in C:\AppServ\www\PHPNuke\modules\gallery\platform\fs_win32.php on line 50

Warning: Invalid argument supplied for foreach() in c:\appserv\www\phpnuke\blocks\block-NG-RandomPhoto_functions.php on line 258

Fatal error: Call to a member function on a non-object in c:\appserv\www\phpnuke\blocks\block-NG-RandomPhoto_functions.php on line 66

I tried to find block-random.cache but I couldn't....what's wrong..?


this was answered on page 2 of this thread. BUT, i'll be nice..

in your albums directory, create a block-random.cache file. also, check both the block file and the _functions file and make sure that $Version_Num is in the globals list at/near the top of the file.

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Tue Dec 30, 2003 3:54 pm
pepbill wrote: › Getting this error

Call to undefined function: fs_file_exists() in /Library/WebServer2/Documents/blocks/block-NG-RandomPhoto_functions.php on line 177

It seems it's relasted to teh cache file. I've created delted chmod 777 and no luck

PHP Version 4.3.2
PHPNuke 7.0
OSX server


actually, it means that the fs_file_exists function can't be found by PHP....BUT, this function is part of gallery, so, make sure you have your GALLERY_BASEDIR properly set.

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
pepbill
Joined: Dec 30, 2003
Posts: 2

Posted: Tue Dec 30, 2003 4:04 pm
I have
/*******************************************************************/
/* Full path to your Gallery, don't forget the trailing / */
/*******************************************************************/
$GALLERY_BASEDIR = "http://pieceoftheocean.com/modules/gallery/";

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Tue Dec 30, 2003 7:56 pm
bzzt...wrong. use the example that was in the file to make sure yours has the proper syntax...it's not the web address, but the full pathname.
it should be something like:

/home/httpd/nuke/modules/gallery/

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
bbongyi
Joined: Dec 27, 2003
Posts: 11

Posted: Tue Dec 30, 2003 9:36 pm
dari,

I found one weired thing....If I click a link after "From" in Random Photo block, it just opens new page inside that Random Photo box....Yes, it works fine if the picture is pressed (Opens a new page with that picture).

I really want to fix this but I'm a novice.....I tried to fix a linking part in the _function but...it was wrong.... Sad

Thanks,

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Wed Dec 31, 2003 7:51 am
hmmmm i thought i fixed all those links...i'll go back and double check. what settings were you using (ie, hourly, auto, random, daily, etc)?

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
bbongyi
Joined: Dec 27, 2003
Posts: 11

Posted: Wed Dec 31, 2003 9:54 am
hello..

dari, I'm using default settings....so, AUTO....I just changed photo changing interval to 30 sec.

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
which
Joined: Sep 02, 2003
Posts: 2

Posted: Wed Dec 31, 2003 11:42 am
i use 7.0 and gallery 1.41
in my download indexpage( i use NSN group download 700-100-b6)
i found this error msg in the aera that should be ng-random block area

Fatal error: Cannot redeclare showresults() (previously declared in /www/html/modules/Downloads/functions.php:394) in /www/html/modules/gallery/util.php on line 2038

whats wrong?

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
bbongyi
Joined: Dec 27, 2003
Posts: 11

Posted: Fri Jan 02, 2004 9:39 am
hmm,

dari, I couldn't find any problem but still it opens new page in the block...... Crying or Very sad

so, I just get rid of the link.... Rolling Eyes !!

thanks,

ps. I like your random block...easy to install for a newbie...thanks again,

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Fri Jan 02, 2004 9:42 am
bbongyi wrote: › hmm,

dari, I couldn't find any problem but still it opens new page in the block...... Crying or Very sad

so, I just get rid of the link.... Rolling Eyes !!

thanks,

ps. I like your random block...easy to install for a newbie...thanks again,


sorry...i'll get on it immediately (the flu fogged my mind for a couple of days.)

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Fri Jan 02, 2004 9:59 am
ok, i checked..the download that's available has the link fixed for the AUTO setting. but, in case you had an older version, here's the fix.

open block-NG-RandomPhoto_functions.php, find the createBlockContent function.
find:
PHP: › <?php function createBlockContent($album,$index,$scale) { ?>

replace with:
PHP: › <?php function createBlockContent($album,$index,$scale,$auto=0) { ?>

next, find the
PHP: › <?php if($scale == 0) { ?>
line. delete the if block and replace with:
PHP: › <?php if($scale == 0) {
                        if(
$auto == 0) {
                                
$IMG "<center><a href=\"$PHOTO_URL\">".$album->getThumbnailTag($index)."</a><br>";
                        }
                        else {
                                
$IMG "<center><a href=\"$PHOTO_URL\" target=\"_top\">".$album->getThumbnailTag($index)."</a><br>";
                        }
        } else {
                        if(
$auto == 0) {
                                
$IMG "<center><a href=\"$PHOTO_URL\">".$album->getThumbnailTag($index,$scale)."</a><br>";
                        }
                        else {
                                
$IMG "<center><a href=\"$PHOTO_URL\" target=\"_top\">".$album->getThumbnailTag($index,$scale)."</a><br>";
                        }
        } 
?>


in the end, the function should look like this:
PHP: › <?php function createBlockContent($album,$index,$scale,$auto=0) {
        global 
$gallery$GALLERY_EMBEDDED_INSIDE$GALLERY_EMBEDDED_INSIDE_TYPE$GALLERY_MODULENAME;

        
$id $album->getPhotoId($index);
        
$caption $album->getCaption($index);
        
$photo $album->getPhoto($index);
        
$dir $album->getAlbumDirURL("full");
        
$image $photo->image;
        
$PHOTO_URL makeAlbumUrl($album->fields['name'], $id);
        
$ALBUM_URL makeAlbumUrl($album->fields['name']);
        if(
$scale == 0) {
                        if(
$auto == 0) {
                                
$IMG "<center><a href=\"$PHOTO_URL\">".$album->getThumbnailTag($index)."</a><br>";
                        }
                        else {
                                
$IMG "<center><a href=\"$PHOTO_URL\" target=\"_top\">".$album->getThumbnailTag($index)."</a><br>";
                        }
        } else {
                        if(
$auto == 0) {
                                
$IMG "<center><a href=\"$PHOTO_URL\">".$album->getThumbnailTag($index,$scale)."</a><br>";
                        }
                        else {
                                
$IMG "<center><a href=\"$PHOTO_URL\" target=\"_top\">".$album->getThumbnailTag($index,$scale)."</a><br>";
                        }
        }
        
$FROM "From: <a href=\"$ALBUM_URL\">" $album->fields['title'] . '</a>';
        
$blockContent .=  "\t$IMG\n";
        
$blockContent .= "\t$caption<br />\n";
        
$blockContent .= "\t$FROM\n</center>";
        return 
$blockContent;
?>

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
bbongyi
Joined: Dec 27, 2003
Posts: 11

Posted: Fri Jan 02, 2004 1:23 pm
sorry, dari..

it didn't work...same as the previous... Crying or Very sad

http://bbongyi.gotdns.com:9000/ [gotdns.com]

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Sat Jan 03, 2004 9:46 am
what browser do you use? i'm using firebird and it's working just fine on your site right now.

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
bbongyi
Joined: Dec 27, 2003
Posts: 11

Posted: Sat Jan 03, 2004 10:47 am
dari, how does it work.... Shocked

I got rid of the link.....Did you try to click that "From: xxxxx"?

I just tried....and still it's same.... it opens a new page inside the block..


could you try again...


by the way, I'm using IE 6.0

thanks always, Very Happy

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Sat Jan 03, 2004 11:02 am
aaaah..i gotcha Smile

the fixed download is available...here's the patch:

in block-NG-RandomPhoto_functions.php, find:
PHP: › <?php $FROM "From: <a href=\"$ALBUM_URL\">" $album->fields['title'] . '</a>'?>


replace with:
PHP: › <?php $FROM "From: <a href=\"$ALBUM_URL\" target=\"_top\">" $album->fields['title'] . '</a>'?>

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
bbongyi
Joined: Dec 27, 2003
Posts: 11

Posted: Sat Jan 03, 2004 11:38 am
Embarassed

you know what...I tried this before.....at that time, it didn't work....so I thouht there is something special....yes, i knew that....probably there was a mistake... Embarassed

thanks, dari...

hmm, it's a time to upload movies..... Wink

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
Puntuk
Joined: Aug 02, 2003
Posts: 4

Posted: Tue Jan 06, 2004 3:36 pm
in my download indexpage( i use NSN group download 700-100-b6)
i found this error msg in the aera that should be ng-random block area

Fatal error: Cannot redeclare showresults() (previously declared in /www/html/modules/Downloads/functions.php:394) in /www/html/modules/gallery/util.php on line 2038
phpnuke 6.9 gallery 1.4.1

whats wrong?

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Tue Jan 06, 2004 3:42 pm
it means that the NSN Download hack uses the same function name as a function in Gallery, specifically, a function called "showresults".

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
kcheng888
Joined: Aug 08, 2003
Posts: 13

Posted: Tue Jan 13, 2004 3:24 am
Does anyone have a link to a website showing the new random block. I would like to see the scrolling picture feature.

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Tue Jan 13, 2004 8:12 am
http://phpnuke.nukedgallery.net [nukedgallery.net]

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
kcheng888
Joined: Aug 08, 2003
Posts: 13

Posted: Wed Jan 14, 2004 3:46 pm
Thanks Dari,

Very nice block.......keep up the great work!!!

This nukedgallery site is the best. I'm using nuked gallery now myself, with over 6000 photos.

kcheng888

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Wed Jan 14, 2004 4:03 pm
Thanks for the awesome feedback. We do our best to make sure that Gallery users get as much support as they need for integrating into PHPNuke portals. Glad to hear that it went smoothly for you, and if you ever need any other Gallery/PHPNuke support, I hope that you come back here for it Smile (shameless plug Wink )

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
daveburley
Joined: Oct 03, 2003
Posts: 18

Posted: Wed Jan 14, 2004 6:47 pm
I installed this block and at first i thought it was working perfectly, but then i noticed as i added new photos that it only kept doing the initial photo set that was installed.

After reading up on this, i thought the cure would be to delete the block-random.cache file in the albums folder !!!

Stupid Wink

Now I have recreated this file as a blank file and chmod to 777

and i get this error now on my block:-

Warning: Invalid argument supplied for foreach() in /home/public_html/blocks/block-NG-RandomPhoto_functions.php on line 258

Fatal error: Call to a member function on a non-object in /home/public_html/blocks/block-NG-RandomPhoto_functions.php on line 66

btw I also tried just removing the block-random.cache file to see it auto regenerated and this is the error i then got:-

Warning: fopen(/home/www/albums/block-random.cache): failed to open stream: No such file or directory in /home/public_html/modules/Gallery/platform/fs_unix.php on line 55

Warning: Invalid argument supplied for foreach() in /home/public_html/blocks/block-NG-RandomPhoto_functions.php on line 258

Fatal error: Call to a member function on a non-object in /home/public_html/blocks/block-NG-RandomPhoto_functions.php on line 66


HELP Smile

NB: im running nuke v7.0 and gallery 1.4.1

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
daveburley
Joined: Oct 03, 2003
Posts: 18

Posted: Thu Jan 15, 2004 8:04 am
has no-one encountered this b4 ?

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
daveburley
Joined: Oct 03, 2003
Posts: 18

Posted: Thu Jan 15, 2004 8:14 am
well i got it working in fashion again,

I restored the block-random.cache file from backup Smile

But a bug i note, is that i have set it to be RANDOM order, scrolling vertically, with 4 pictures. It has got duplicate images being shown and it is still only showing some of the photos, not all of them

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
daveburley
Joined: Oct 03, 2003
Posts: 18

Posted: Thu Jan 15, 2004 8:24 am
wehay, i set the cache timer to 300 as someone else mentioned previously and it rebuilt the cache with all the albums / photos Smile see it in action finally at www.vetpro.co.uk

There is def still abug in it where it does dupes though, needs some form of check for that Dari ?

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Thu Jan 15, 2004 8:33 am
re: the duplicate images...it will be a problem if you have only a couple of albums with very few images, or if you ask for it to display more images that you have in all of your albums (ie, you have 1 album with 2 images, yet you ask for it to display 4).

i could add in a check for duplicate images, though that may significantly increase load times....i'll look into it.

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
pure
Joined: Jan 16, 2004
Posts: 1

Posted: Fri Jan 16, 2004 12:32 pm
Now this is little off topic.

I haven't used the block on my stie but I was looking for something little similar.

Dari a question for you.

I have a media site hosting video songs, dramas and interviews. What I was looking for something to display pictures of the latest video songs, drams and intervies which has been uploaded and have those pictures scroll horizontally. And when the user click on any of the picture it would take them to the appropriate section (Video Songs, Drama or Interviews) from where they can select the video or drama to watch.

Now is it possible to do that with your NG-Photo or NG-Random block?

I would really appriciate if I could get some feedback.

Thak you.

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
shanmoon
Joined: Feb 16, 2004
Posts: 3

Posted: Mon Feb 16, 2004 5:05 pm
I've the the files installed in the appropriate locations, i've reset the cache and changed it to 300, and verified that the global version_num variable is added to the php files, but I still get this error:

Warning: Invalid argument supplied for foreach() in /www/moonbase/webapps/ROOT/andy/modules/gallery/session.php on line 64

although the random pics are displayed appropriately....

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
slackbladder
Joined: Mar 29, 2003
Posts: 1038
Location: Cambs,UK
Posted: Mon Feb 16, 2004 5:08 pm
NukedGallery FAQ D.1. [nukedgallery.net]

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
toben
Joined: Feb 21, 2004
Posts: 1

Posted: Sat Feb 21, 2004 12:07 pm
Mine appears to work but I only get the left side of the photo to show

see it here - http://darthvader.tv [darthvader.tv]

it is this wide ---
when it should be this wide -----------------

Any ideas?
phpnuke 7.0
gallery 1.3.4

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
littledave
Joined: Feb 29, 2004
Posts: 1

Posted: Sun Feb 29, 2004 9:55 pm
I recieve thes errors any followed by a lot more.

Warning: Invalid argument supplied for foreach() in C:\PHP-Nuke-7.0\html\modules\gallery\session.php on line 64

Warning: fopen(/PHP-Nuke-7.0/html/modules/gallery/albums/block-random.cache): failed to open stream: No such file or directory in C:\PHP-Nuke-7.0\html\blocks\NG-RandomPhoto_functions.php on line 221


see it @ www.littledave.net

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
slackbladder
Joined: Mar 29, 2003
Posts: 1038
Location: Cambs,UK
Posted: Mon Mar 01, 2004 1:35 am
In your PHP.INI :

display_errors = On

try

display_errors = Off

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
rquinat
Joined: Mar 02, 2004
Posts: 5

Posted: Tue Mar 02, 2004 2:46 pm
Hello World,

when i am in the gallery page every thing all right.
When i go in every other sections I have these warnings.


Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/romain/www.quinat.com/public_html/nuke/header.php:32) in /home/romain/www.quinat.com/public_html/nuke/modules/gallery/session.php on line 60

Warning: Invalid argument supplied for foreach() in /home/romain/www.quinat.com/public_html/nuke/modules/gallery/session.php on line 64


Thanks
Sad Sad

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
911Racing
Joined: Mar 11, 2004
Posts: 2

Posted: Thu Mar 11, 2004 5:46 pm
Works great so far. Thanks for the great block.

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
gameznet
Joined: Sep 18, 2003
Posts: 1

Posted: Mon Mar 15, 2004 2:50 pm
This really is a great block!

Is there any way to set it so that it will rotate "all pics" in the gallery rather than having to set a value. I tried setting a value of 99 but then it takes ages for the site to load as I presume its caching all the images first so I had to take it down to 5 images to keep the load time down. The thing is that its quite entertaining just watching the images scroll by and would be great if it would work for as many images as there are in the gallery. I dont know much about this stuff but I am certain that my site visitors would enjoy watching a seemingly endless flow of images scroll by as much as I do but obviously noone is gunna wait 5 minutes for the page to load . Id like to set up a kinda "movie" or comic strips in this way.

With a well set up gallery it could be as good as watching TV if the caching wasnt an issue Wink

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
mano
Joined: Mar 07, 2004
Posts: 1

Posted: Wed Apr 07, 2004 10:12 am
I have a small issue. It is showing photos of hidden and private albums to non logged in users. Now if they try to click on it it will not load, but I need to not have these images show up in the front page unless they are a member.

And on a second note, is there a way to create user groups so only those members of nuke that I want can access the album without having to set each name individually?

Thanks.

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Wed Apr 07, 2004 10:26 am
hmm....if albums are hidden...not sure about that (those are diff than albums requiring a user to be logged in..). i'll check into it.

as for the groups, not in Gallery 1, wait for Gallery2.

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
inSaNE_iRIsH
Joined: Jun 19, 2003
Posts: 101

Posted: Thu Apr 08, 2004 3:07 pm
i am trying to run multiple instances of this block (each will pull from different albums), but am getting this error
Code: › Fatal error: Cannot redeclare createblockcontent() (previously declared in /home/virtual/site21/fst/var/www/html/html/blocks/NG-RandomPhotoSelectTest_functions.php:63) in /home/virtual/site21/fst/var/www/html/html/blocks/NG-RandomPhotoSelectTest_functions2.php on line 63


basically i just copied all three files and renamed them with "2" on the end and renamed the references in each file to include the "2"

any ideas?

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
XTz
Joined: Apr 09, 2004
Posts: 2

Posted: Fri Apr 09, 2004 3:14 pm
I get the next error when I want to run...
Can somebody help me???

Thanks...


Code: ›
Warning: fopen(http://xtz.dreamsite.be/doven/modules/gallery/albums/block-random.cache): failed to open stream: HTTP wrapper does not support writeable connections. in /opt/www/balzarinit/web/xtz.dreamsite.be/doven/blocks/NG-RandomPhoto_functions.php on line 221

Warning: fwrite(): supplied argument is not a valid stream resource in /opt/www/balzarinit/web/xtz.dreamsite.be/doven/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fclose(): supplied argument is not a valid stream resource in /opt/www/balzarinit/web/xtz.dreamsite.be/doven/blocks/NG-RandomPhoto_functions.php on line 225

Fatal error: Call to undefined function: isalbumname() in /opt/www/balzarinit/web/xtz.dreamsite.be/doven/blocks/NG-RandomPhoto_functions.php on line 101

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
raff
Joined: Apr 13, 2004
Posts: 2

Posted: Tue Apr 13, 2004 5:21 am
i have uploaded everything, all settings seem right. .. but when i go to activate the block in the admin section it does not show up. also other blocks that are the blocks directory dont show up... i tryed googling it and didnt come up with much.. any help appreactiated
raff

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
darkknight
Joined: Aug 21, 2003
Posts: 54

Posted: Thu Apr 15, 2004 11:01 am
My gallery has grown larger, and now the script no longer runs in the 8mb of ram php is set to use. Now, my provider said that 8mb should be enough and they would rather not change it, as it affects performance if any scripts break.

What i want to know, is why isnt it possible to keep this script under 8mb? it surely cant be needing to have 8mb of data held at a time?

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
inSaNE_iRIsH
Joined: Jun 19, 2003
Posts: 101

Posted: Thu Apr 22, 2004 12:01 pm
what happened to dari (or any of the guys that answer questions) around here? i havent seen a post from any of them in a couple of weeks

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
slackbladder
Joined: Mar 29, 2003
Posts: 1038
Location: Cambs,UK
Posted: Thu Apr 22, 2004 12:09 pm
Dari has been away for a couple of weeks - he's due back shortly. Everyone else is still here Smile

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
inSaNE_iRIsH
Joined: Jun 19, 2003
Posts: 101

Posted: Thu Apr 22, 2004 1:30 pm
inSaNE_iRIsH wrote: › i am trying to run multiple instances of this block (each will pull from different albums), but am getting this error
Code: › Fatal error: Cannot redeclare createblockcontent() (previously declared in /home/virtual/site21/fst/var/www/html/html/blocks/NG-RandomPhotoSelectTest_functions.php:63) in /home/virtual/site21/fst/var/www/html/html/blocks/NG-RandomPhotoSelectTest_functions2.php on line 63


basically i just copied all three files and renamed them with "2" on the end and renamed the references in each file to include the "2"

any ideas?


slack, do you have any ideas on this issue or do i have to wait for dari?

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
slackbladder
Joined: Mar 29, 2003
Posts: 1038
Location: Cambs,UK
Posted: Thu Apr 22, 2004 1:39 pm
I would try renaming the 'functions' in the blocks also.

EX:

function createblockcontent()

=

function createblockcontent2()

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
inSaNE_iRIsH
Joined: Jun 19, 2003
Posts: 101

Posted: Thu Apr 22, 2004 1:41 pm
yeah, i tried that, if i change every single function i get a different error, dont remember what off hand, i will try it again and post the new error it creates

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Fri Apr 23, 2004 9:36 am
ah...for the multiple instances..
you can have multiple block files, but only *one* support file...so, name the block files:
block-Random, block-Hourly, block-Daily, etc....but keep the RandomSupport file, and just have one copy of it. make all the block files reference that one support file in their header. it should work just fine.

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
inSaNE_iRIsH
Joined: Jun 19, 2003
Posts: 101

Posted: Tue Apr 27, 2004 11:42 am
oops, i just realized i posted that question in the wrong thread, i am using the "selectable" album version...i will post in that to help keep things straight.

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
wysard
Joined: Apr 29, 2004
Posts: 8

Posted: Sun May 02, 2004 1:51 pm
Hi:

I hope I got the right thread, I've been searching.

I'm trying the NG-RandomPhotoV2 and getting the following errors:

Warning: Invalid argument supplied for foreach() in /home/kingwood/public_html/home/blocks/NG-RandomPhoto_functions.php on line 276

Fatal error: Call to a member function on a non-object in /home/kingwood/public_html/home/blocks/NG-RandomPhoto_functions.php on line 101

I only made the changes suggested in the README.

Thanks Sad

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
wysard
Joined: Apr 29, 2004
Posts: 8

Posted: Mon May 03, 2004 10:31 am
Hi:

I'm getting more errors now? Not sure why? Please help with some ideas, I'm new to PHP.

Warning: fopen(/home/kingwood/public_html/home/albums/block-random.cache): failed to open stream: Permission denied in /home/kingwood/public_html/home/blocks/NG-RandomPhoto_functions.php on line 221

Warning: fwrite(): supplied argument is not a valid stream resource in /home/kingwood/public_html/home/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fwrite(): supplied argument is not a valid stream resource in /home/kingwood/public_html/home/blocks/NG-RandomPhoto_functions.php on line 223

Warning: fclose(): supplied argument is not a valid stream resource in /home/kingwood/public_html/home/blocks/NG-RandomPhoto_functions.php on line 225

Fatal error: Call to undefined function: isalbumname() in /home/kingwood/public_html/home/blocks/NG-RandomPhoto_functions.php on line 101

Thanks Cool

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
rioguia
Joined: Nov 16, 2003
Posts: 12

Posted: Fri Nov 05, 2004 1:30 pm
i am having the same memory error problem noted earlier but have not found a solution. i have the latest cv release of gallery(1.5?) with the random-block functions modified (edited the NG-RandomPhoto_functions.php. file by replacing every instance of the function, "isAlbumName" with the function "getAlbumName."). My gallery is inbedded in nuke 7.3 and running on fedora core 2 / apache 2.05.
i suspect that is because my gallery has over 4000 pics (i have kids and distant family). i'd be happy to make any adjustments to my server to accomodate this probem if someone would give me some suggestions (or terms to google on)

specifc errors i get are:
i get errors in my log
/var/log/httpd/www.primary.com_errors

PHP Fatal error: Allowed memory size of 8388608
bytes exhausted (tried to allocate 20 bytes) in
/var/www/html/modules/gallery/classes/Album.php on line 783

Code: ›    function loadPhotosFromFile($filename) {
                $tmp = unserialize(getFile($filename));
                if (!is_Array($tmp)){
line 783 --->    $tmp = unserialize(getFile($filename, true));
                        if (!is_Array($tmp)){
                                return 0;
                        }
                }
                if (count($tmp) > 0) {
                        if (strcasecmp(get_class($tmp[0]), "albumitem")) {
                                /* Dunno what we unserialized .. but it
wasn't an album! */
                                return 0;

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Tue Nov 09, 2004 9:44 am
the error you are getting is a PHP error, not a random block error. you must increase the allowed memory size variable in your php.ini

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
rioguia
Joined: Nov 16, 2003
Posts: 12

Posted: Tue Nov 09, 2004 12:36 pm
thanks for your response. i now understand that one fix would be to increase the memory limit in /etc/php.ini. in my case, it requires memory_limit 32M. Since php.ini governs any php script, i am concerned that just increasing the limit for the entire server could cause stability problems. It's my understanding that there are alternatives for setting the memory limit, especially in a .htaccess file and as part of the virtual host configuration:

Code: › php_admin_value memory_limit 32M


Is this true? Also, does this memory hit only last while the script is loading or will the memory consumption continue?

Also, I wonder if there are some programming work arounds. I'm not a programmer but it looks like gallery calls the entire array before it gets the object it needs. I wonder if the overhead would be less if instead of calling the entire array if it would be possible to call just the specfic objects within the array? As I said, i am not a programmer, so i appologize in advance if my analysis is incorrect.

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
dari
Joined: Mar 03, 2003
Posts: 6287
Location: Washington Township, NJ, USA
Posted: Tue Nov 09, 2004 1:35 pm
yes, editting php.ini will affect the entire server. see http://us2.php.net/function.ini-set on how to set php.ini vars on a per-script basis.

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
ophidite
Joined: Mar 31, 2004
Posts: 15

Posted: Thu Nov 25, 2004 11:05 am
Here is the error i get when i try to activate the block

Fatal error: Call to undefined function: isalbumname() in /data/www/com/e/t/ophidite.com/www/htdocs/blocks/NG-RandomPhoto_functions.php on line 71


Any clue

Thganks in advance

AuthorMessage
Post Title: Re: [TESTING] Random Photo- Version 2.0
slackbladder
Joined: Mar 29, 2003
Posts: 1038
Location: Cambs,UK
Posted: Thu Nov 25, 2004 1:42 pm
This has been answered many times before, please try searching these forums using:

isalbumname()
or
getalbumname()

All times are GMT - 5 Hours
Powered by PHPNuke and phpBB2 © 2006 phpBB Group