Any chance I can make the script shows 3 columns per page?
Thanks
hollism16
Joined: 2004-03-03
Posts: 47
Posted: Sat, 2004-03-20 18:30
Man, Jeremy, they need to have YOU do the search.php file. I don't like how it shows everything on one giant page- and the stats.php results match the individual's site much better too. Thanks again for your mod bro- they're the highest-viewed pages on my site now. Later~
Hollis
Terje-
Joined: 2004-01-20
Posts: 90
Posted: Sun, 2004-03-21 01:48
This truely rules myriagon! Excellent work.
Now, we just need to get this included in 1.4.4 =]
Regards,
Terje
myriagon
Joined: 2004-01-22
Posts: 130
Posted: Sun, 2004-03-21 20:00
xinca, what you ask could be done but it would be a major hack on top of what I've already done and it would make the code more difficult to maintain. I'm also not sure where all the text would go? Underneath each photo perhaps?
Cheers, J
myriagon
Joined: 2004-01-22
Posts: 130
Posted: Sun, 2004-03-21 20:26
Hollis - thanks for the kind words. Adding a search function to stats.php wouldn't be too difficult although the functionality would overlap with what's already supported by the Gallery Search - something I prefer to avoid. Hacking the existing Search to move away from using the giant page shouldn't be too difficult either although I haven't studied that code.
Cheers,
Jeremy
myriagon
Joined: 2004-01-22
Posts: 130
Posted: Sun, 2004-03-21 20:34
bificypdog - what's your website url? I would like to see what you're trying to do although having no postnuke experience myself I doubt I can help without setting it up myself. Send me an email if you want to keep the url private.
This apparently didn't work - something that I keep meaning to look into. Maybe postnuke is trying to do something similar?
Cheers, J
myriagon
Joined: 2004-01-22
Posts: 130
Posted: Sun, 2004-03-21 20:47
Thanks Terge - Having spent my software developing life working mostly with corporates it's great to be doing something for the community for fun and to be learning something new at the same time.
Cheers, Jeremy
BTW it would be excellent to see stats.php in 1.4.4.
shoobeedoodoo
Joined: 2004-01-11
Posts: 78
Posted: Tue, 2004-03-23 04:48
Just out of curiousity, but is anyone here being hosted by 1and1.com (the free 3-year plan) and have stats.php working with about 1000 images?
Thanks!
-Stephen
anonymous11234
Joined: 2002-12-05
Posts: 135
Posted: Wed, 2004-03-24 13:51
In my gallery at http://ourphotos.org I got your script working great, thanks. However, as you'll see in http://ourphotos.org/stats.php it removes the navigation back to the main albums and gallery. Is there a way to keep the original navigation too so people can get to the main page without hitting the "back" button?
FDFLocke
Joined: 2004-01-02
Posts: 10
Posted: Tue, 2004-03-30 15:07
First of all: great script and it works fine!
I´ve got 2 questions:
1. Is it possible to change the sort order of the comments? So that it starts with the oldest comments?
2. It would be nice to add directly a new comment to the picture if using the view=comments option. Maybe as a link like [add comment]?
I will leave it "as is" for now until the developers release a beta or rc. It would be good though if the same api could be kept for backward compatibility.
Guess I will have to sign up to the developers list to find out what's happening.
Cheers, J
anyone tried to rename the function in this topimages script?...or is the function itself also edited...?
myriagon
Joined: 2004-01-22
Posts: 130
Posted: Wed, 2004-03-31 21:56
Haplo - Terge just renamed the function and it worked. See here
All the function is doing is returning an indication that the image is really an image or an album. I wouldn't expect the underlying code to change, just the function name.
FDFLocke, watch this space
csilkman, on my site I have a html_wrap/stats.header file which provides links to the rest of the site. Checkout the guide at eclecticpixels which describes how to set this up. Alternatively you could always add a simple link to stats.php to get back to your main albums.
vaporinc
Joined: 2004-04-01
Posts: 13
Posted: Thu, 2004-04-01 22:57
Hey myriagon, I have a question for you. I have a decent understanding of what is going on with the coding of gallery. I have customized the headers and footers in the past, and I have edited the voting options in my own gallery in the .php files. Yet, I am having a problem making your code work.
I think I know where the problem lies, but would like your input. The search function use to work on my site when I first implented it, however it stopped functioning a while back. I don't know what I did to stop it from working. I'm thinking this may be tied into the reason why I can't get your code to work. What do you think?
Hey vaporinc, thanks for posting - your problem sounds like the one shoobeedoodoo's has been experiencing.
The search code uses very similar code to stats.php so I'm 95% certain if we can fix stats.php then we could get search to work too. I believe shoobeedoodoo's problem is resource related. Is there any chance that you are also hitting a resource limit imposed by your ISP? I suspect as you have added more photos at some point you have hit a resource limit stopping search from working and now you have the same issue with stats.php
I would like to add more debug code to stats.php to tell me how far it's getting before failing. I will do that first thing tomorrow as it's very late here now. One experiment you could try is to setup a test gallery with a test set of albums. Then try deleting some of the photos to find if/when stats.php starts to work.
Hope that makes sense,
Regards, J
myriagon
Joined: 2004-01-22
Posts: 130
Posted: Thu, 2004-04-01 23:45
You could also try adding the following code near the top of stats.php to check some resource limits:
vaporinc - I have now added some more debug code - try the latest version of stats.tar.gz
You can see the debug info by using stats.php?type=views&debug=2
Regards, J
floridave
Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2004-04-03 05:08
myriagon,
I have tried the latest version (1.7.1) and find it great except for the comments. Fine in Mozilla but in IE the comments sometimes go off the right. I see from the code you have a workarround for IE. What was the reason?
On your site and another it looks fine except comments.
I have restored the custom wraper files I was using; and it did not fix the issue.
I have also tried on 1.4.3RC1 and all the rest function fine. http://langleycom.com/g1/stats.php?type=comments (1.4.3RC1) http://langleycom.com/gallery/stats.php?type=comments (1.4.2)
Ideas?
Also in the next version can you add another config for having a comment link (off/on)
The reason for the hack was an attempt to fix the problem you are seeing with IE. Unfortunately nasty hacks have a habit of coming back to bite later. If you set $numReturns = 1;
rather than:$numReturns = 0;
then I suspect the problem will go away - however this is not the right answer.
I really need to understand what is going on here. When I was writing that code I found that for IE only, the comments went off to the right as you are seeing. I tried lots of variations to make it work. The only thing that I found that worked was to count the number of rows (views, upload date, etc) that have gone before and add a <br> for each one. It was almost as though IE wanted a terminator for each of those rows. Strange...
I wonder if there's something in your skin that is causing the difference between your site and mine? I will try some more tests today to see if I can find the right solution.
Thanks for the code to add a comment. I was going to do that this weekend and you have saved me some time now
Thanks, Jeremy
myriagon
Joined: 2004-01-22
Posts: 130
Posted: Sat, 2004-04-03 16:43
There's a new version of stats available here. For a demo check out my site
Dave - I have fixed the problem with the comments. I had the right idea with that nasty hack using <br>'s. The correct solution is to use <br clear=all>. I have also added the [add comment] link. You can control this from the url using sac=0,1 or by changing $showAddComment in the code.
FDFLocke - I've added a variable $newestCommentsFirst to control the comment order. By default this is set to 0 so it will list oldest comments first which I prefer now and the way you suggested.
RaVen - I have added code for your suggestion about overriding the photos per page (ppp) and total number of photos (total) from the url. For example stats.php?type=date&ppp=5&total=20
If anyone has any other ideas or problems then please post here and I will see what I can do - I'm still thinking about adding voting - maybe that will be next.
Cheers, J
bificypdog
Joined: 2004-03-15
Posts: 26
Posted: Sat, 2004-04-03 17:17
Fatal error: Call to undefined function: isalbumname() in C:\xampp\htdocs\postnuke\modules\gallery\stats.php on line 193
(local Webspace)
STATS-Version 1.72
myriagon
Joined: 2004-01-22
Posts: 130
Posted: Sat, 2004-04-03 17:29
bificypdog - if you are using the latest rc then that function has been renamed. Try reading back a few pages or look here
bificypdog
Joined: 2004-03-15
Posts: 26
Posted: Sat, 2004-04-03 21:06
Thanx.
I replaced all "isalbumname" to "isalbum" in stats.php.
It this right?
But, if entered "stats.php?type=views" I only see one picture.
(It is my upload-album, where specified users have rights)
Postnuke-Link: (I added stats.php in index.php)
.../modules.php?set_albumName=&op=modload&name=gallery&file=index&include=stats.php
Quote:
$statsVersion = 1.72;
// Control variables - the show* ones can be overidden by the url.
$photosPerPage = 10;
$totalPhotosToDisplay = -1; // Set to -1 for all photos.
$showCaptureDate = 1;
$showUploadDate = 1;
$showViews = 1;
$showVotes = 0;
$showComments = 1;
$showAddComment = 1;
$newestCommentsFirst = 1;
myriagon
Joined: 2004-01-22
Posts: 130
Posted: Sat, 2004-04-03 21:22
bificypdog - I have now added support for 1.4.3. Try downloading the new version (1.73) from here - that should work out of the box. Get back to me if it doesn't.
Regards, J
bificypdog
Joined: 2004-03-15
Posts: 26
Posted: Sat, 2004-04-03 21:24
myriagon wrote:
bificypdog - I have now added support for 1.4.3. Try downloading the new version (1.73) from here - that should work out of the box. Get back to me if it doesn't.
Regards, J
I LOVE YOU ;-)
It's working. Thanx-a-lot.
bificypdog
Joined: 2004-03-15
Posts: 26
Posted: Sat, 2004-04-03 21:31
Next Problem:
I mentioned it before: I am using postnuke.
I added "stats.php" in "index.php" --> $safe_to_include
If I use the absolute path for the gallery, it is working:
Quote:
e.g.
.../modules/gallery/stats.php?type=date
But If I use stats.php with the postnuke-syntax, I get an error:
Quote:
e.g.
.../modules.php?set_albumName=&op=modload&name=gallery&file=index&include=stats.php?type=date
Following Error: Fatal error: Call to undefined function: _() in C:\xampp\htdocs\postnuke\modules\gallery\index.php on line 155
Lines in index.php
153 if (!in_array($include, $safe_to_include)) {
154 $include = escapeshellcmd($include);
155 print sprintf(_("Security error! The file you tried to include is not on the <b>approved file list</b>. To include this file you must edit %s's index.php and add <b>%s</b> to the <i>\$safe_to_include</i> array"),
156 'Gallery', $include);
157 exit;
Please, could you help me?
bificypdog
Joined: 2004-03-15
Posts: 26
Posted: Sat, 2004-04-03 21:33
BTW. I must user the postnuke-syntax. Sorry. ;-)
I can't publish my site with the direct-path
Sorry for my english ;-))
myriagon
Joined: 2004-01-22
Posts: 130
Posted: Sat, 2004-04-03 22:20
I know nothing about postnuke but try replacing the "?" before the type with a "&", eg.
That should work - it seems to be ok for me. Good to see you have done some localization. Wish my German was as good as your English...
Cheers, J
floridave
Joined: 2003-12-22
Posts: 27300
Posted: Sat, 2004-04-03 22:22
myriagon wrote:
bificypdog - I have now added support for 1.4.3. Try downloading the new version (1.73)
Damn, I was going to give you a hand with that. I started with some paper and pen but that is as far as I got. You did a much better way than I was thinking!
Dave
bificypdog
Joined: 2004-03-15
Posts: 26
Posted: Sat, 2004-04-03 22:41
Wow.Cool. How simple.
What can I say: Thanks again.
Haplo
Joined: 2004-03-29
Posts: 82
Posted: Sat, 2004-04-03 22:53
myriagon wrote:
If anyone has any other ideas or problems then please post here and I will see what I can do - I'm still thinking about adding voting - maybe that will be next.
Cheers, J
sweet...great gallery addon...
BUT, the name= variable is blank in all my urls trying to link to gallery
...but i solved it in the modules.php file (embedded gallery with phpbb2) doing a !empty check
now only the "toprated" switch is missing ;)
EDITED: toprated seems to be inlcuded already, style=votes...or what am i missing...
thanx
P.S. using Gallery 1.4.3+
Haplo
Joined: 2004-03-29
Posts: 82
Posted: Sun, 2004-04-04 12:54
probably already discussed...but what about cache...or do this script have to search through all images every time...load time for big galleries??
myriagon
Joined: 2004-01-22
Posts: 130
Posted: Sun, 2004-04-04 15:26
Haplo - that's a good point about caching. Performance is something that I've been concerned about since I started doing stats.php. I'll have a look at what's involved. It should give me experience of the php file system functions too which would be cool.
For those asking about voting, I had a quick look at the Gallery rank and critique types of voting. Anyone know an easy way of deciding the voting order across all the albums? I could get an average score for each photo or add all the points together for each photo. Either way will be slow and ideally need a caching solution. If I go with the average solution then a photo which has 10 "Very Good" votes would rate lower than a photo with one Excellent vote. That doesn't seem right. Also if you have a vote category of Poor (1 point) then this could make a photo that has a Poor vote appear better than a photo with no votes. Maybe photos with no votes should be excluded from the list. It would be a easier if people could give a vote to the photos they like and not worry about rating them too with the "Excellent", "Very Good" etc. Thoughts anyone?
Cheers, J
floridave
Joined: 2003-12-22
Posts: 27300
Posted: Sun, 2004-04-04 18:15
myriagon,
I think the voting in Gallery needs to be rethought altogether. The ranking system is not user friendly. The results are not very clean looking. That is the reason why I, as well as many other users have not implemented the voting in Gallery.
I think the one click option, like on your site, is a much better idea. Very user friendly and much easier to count and the results page looks like the rest of the pages. Very nice.
Just my 3Bahts worth.
Dave
hollism16
Joined: 2004-03-03
Posts: 47
Posted: Sun, 2004-04-04 18:53
Quote:
Anyone know an easy way of deciding the voting order across all the albums? I could get an average score for each photo or add all the points together for each photo. Either way will be slow and ideally need a caching solution. If I go with the average solution then a photo which has 10 "Very Good" votes would rate lower than a photo with one Excellent vote. That doesn't seem right.
I find that more people vote on things than comment (less time consuming I guess), so that would be really cool if you could get it working.
I think that what you're talking about is very true- and I would be torn on the issue as well. For me at least though, I think that a "votes" list based off of the number of votes on an item would end up looking an awful lot like my "most viewed" stats. If you're going to base it off of the votes, then it should be off of the highest ranked ones. Users will go in there and adjust what they like and don't like accordingly. It just seems like that would be going "all the way" for that feature- why spend time making something that's going to look like what you've already created? I also really like the idea of adding all the votes together to make a "big" vote number... that's definitely a good idea too. Do you think you could have it show a tally of all the different types of votes it received too?
Also, I don't know if you can adjust the number of vote options for each sub-album...? If so, that might be a snag for you.
Here's another idea too- how about implementing a "random items page" option on there as well? You could implement the IFrame random block or similar. Here's an html page I made with lots of random blocks: http://webhollis.com/random.html
It's so cool that this feature is still growing! I'm going to keep an eye on this thread.
Later~
Hollis
Haplo
Joined: 2004-03-29
Posts: 82
Posted: Mon, 2004-04-05 08:08
i do not think iframes are needed (honestly those are ugly as...), since the stats script may exract and display images by itself...a rand is all thats needed...
votes:
agree with some of you, the gallery votes are messy and not very intuitive...hopefully the gallery team will think twice for G2
but since we're stuck with current implementation, a toprated list should extract images based on average vote score...with a cut off for let's say less than 2 votes (defined with a parameter)...
for example
Image XXX
Ratings: 2.76 / 5 (7 votes)
cache:
a must someday...maybe that gallery-rand script could be mimicked...it has cache ;)
anyone tried this stats script for really huge galleries...what load time are we talking about?
carmosin
Joined: 2003-11-18
Posts: 15
Posted: Mon, 2004-04-05 12:39
Haplo, I use this script for a gallery with about 6000 pictures and it is slow, but not painfully so. In the end I think I am the one to blame for it being slow anyway since I am running my webserver on a 266 :]
/Jenny
Haplo
Joined: 2004-03-29
Posts: 82
Posted: Mon, 2004-04-05 12:54
lol...yea...but im glad to hear its working "ok" for such a big gallery on such a "server"...
...but implementing toprated would probably need caching since more calculations are needed
myriagon
Joined: 2004-01-22
Posts: 130
Posted: Mon, 2004-04-05 16:42
JennyGlad to hear stats is working ok with 6000 images and a slow server. I was pleasantly surprised when I saw a site that was loading in about a second with 3000 images. Thinking about how it works, the number of files that are loaded depend on the number of albums you have. Of course with more images the amount of data read from files is larger and the sorts will consume more time but that should be in memory. Caching should make a significant performance benefit but for a site that loads quickly already I would keep caching off. That way the information displayed is always up-to-date.
Dave - agreed about Gallery voting. I hope the Gallery team have a rethink. It would be cool to get my simplified voting included in Gallery. stats.php came out of my work on simplifying voting. Initially stats.php only supported voting. I'll have another rethink about what's involved in doing a Gallery patch to support the simplified voting.
and more style parameters: x columns, text below image etc...
EDITED: it really bugs me im not that confortable with the gallery way of handling things...db approach is soooo much easier to understand ;)
myriagon
Joined: 2004-01-22
Posts: 130
Posted: Mon, 2004-04-05 20:15
Hollis - I like the idea of random photos. Your implementation already looks very good. Maybe when I get some time I might implement it in stats.php as it would be good to get that on my site.
Hollis - I like the idea of random photos. Your implementation already looks very good. Maybe when I get some time I might implement it in stats.php as it would be good to get that on my site.
Well, it's actually just an html page, so feel free to grab and modify it to your needs (you will obviously need the random block iFrame php files).
Here's another idea- how about "most comments"? I've seen some pretty good threads going on individual photo's pages. Later~
Hollis
Haplo
Joined: 2004-03-29
Posts: 82
Posted: Wed, 2004-04-07 21:51
ok, here we go
i've done some addons for the script:
NEW TYPES
- random album // display random album (highlight Pic), type=rand_album
- random image // does what it says, type=rand_photo
- latest albums // display latest albums (highlight pic), type=latestalbums
NEW STYLES
- layoutInfoBelowImage // i prefer having the text info BELOW the image, so this is a switch for doing it ;)
- showAlbumOwner
NOTE: I've developed this script further for usage as a block within the mx-portal environment...so there may be some typos when reverting back to standalone code...please report back any issues and i fix it asap
EDIT: seems to be working
NOTE2: the random image is found by first selecting a random album, and then selecting a random image within that album...this means images in large albums will be less frequently selected...but why not ;) ...the reason why is to stick closely to original code and modify as little as possible....
ENJOY
History:
ver. b
- beta
ver. c
- fixed typos and added showAlbumOwner switch
ver. d
- some code cleanup, no feature changes
ver. e
- typo on line 50 ;)
ver. f
added function for average rating -> topratings...not efficient code but working ;)
floridave
Joined: 2003-12-22
Posts: 27300
Posted: Wed, 2004-04-07 22:58
Very nice.
A couple of points.
1. Have the ability to show or not show the album owner.
2. When $layoutInfoBelowImage == 1 have all information center or left not just the image.
3. $gallery->html_wrap['frame'] = the same as the frame that is set in config for images or albums depending on what you are viewing.
4. Typo in the readme: $type == "rand_photo" Random Pics" & $type == "rand_album" You forgot the underscores.
Now the BIG question is there going to be 2 maintainers of stats.php? Will Haplo and myriagon likely integrate each others changes?
This thread is getting verrrry long and perhaps a version 2 should start it own thread when Haplo and myriagon agree?
Dave
Haplo
Joined: 2004-03-29
Posts: 82
Posted: Wed, 2004-04-07 23:07
1) will do
2) will consider, since i normally use the script for portal blocks never wider than 200 pixels = looks nice as is
3) do not follow...what?
4) will fix
im was not planning to maintain this code...i was hoping myriagon would accept my addons and intergrate to main stats.php
but we'll see when he's given some feedback
vaporinc
Joined: 2004-04-01
Posts: 13
Posted: Wed, 2004-04-07 23:29
Sorry it took a while to get back to you. I think you are correct when you say it is a memory issue. I updated stats.php with your new version. And it appears when debugging it, it only recurses 76 of the 168 albums. Any more ideas? Or is this most likely a server-side issue.
In config.php there is some vaiables set for different frames:
$gallery->app->default["album_frame"] = "notebook";
$gallery->app->default["thumb_frame"] = "dots";
$gallery->app->default["image_frame"] = "shadows";
These veriables can be overwriten and different for each album.
Presenly the code is hardcoded with $gallery->html_wrap['frame'] = "solid';
Now that you have added the album capability it should use the album image frame. So: $gallery->html_wrap['frame'] = $gallery->album->fields['image_frame'];
But then again I would not want different frames around the images pulled from different albums.
So I guess I would like to have the same frame wrapped around the image as the album IF all photos are from the same album else a default frame as is now.
I hope that makes more sence.
Dave
Haplo
Joined: 2004-03-29
Posts: 82
Posted: Thu, 2004-04-08 07:40
a....ok...follow....another switch on/off it is ;)
DarkunderdoG
Joined: 2003-08-16
Posts: 58
Posted: Thu, 2004-04-08 23:36
other problems with random are that if you have an album that in it only has subalbums it generates no picture found in random album. It also has the same problem with albums.
carmosin
Joined: 2003-11-18
Posts: 15
Posted: Fri, 2004-04-09 07:49
Hi!
I have been playing around with this script since I want to add a functionality that'll take the arg "time" and display all pictures that was taken that specifik day or month or year. Since I am very new to php I can't figure it out. Please help if you find it to be an interesting idea ;)
/Jenny
Haplo
Joined: 2004-03-29
Posts: 82
Posted: Fri, 2004-04-09 08:02
DarkunderdoG wrote:
other problems with random are that if you have an album that in it only has subalbums it generates no picture found in random album. It also has the same problem with albums.
i know
and has hinted in the code that "error mess" is a temp soloution
problem is i didn't want to modify original code too much, and original code firts loops through all albums, then inlcuded photos for each album
but i will add a check to validate if the album contains photos or not before proceeding
and then clean up the code ;)
hang on
myriagon:
it concerns me im flooding your thread with my own addons to your script, please let me know if i should step back...but i feel its important to keep the mod in one place or else we'll get multiple instances and noone knows what's been fixed in what version...
Posts: 86
Hi,
Any chance I can make the script shows 3 columns per page?
Thanks
Posts: 47
Man, Jeremy, they need to have YOU do the search.php file. I don't like how it shows everything on one giant page- and the stats.php results match the individual's site much better too. Thanks again for your mod bro- they're the highest-viewed pages on my site now. Later~
Hollis
Posts: 90
This truely rules myriagon! Excellent work.
Now, we just need to get this included in 1.4.4 =]
Regards,
Terje
Posts: 130
xinca, what you ask could be done but it would be a major hack on top of what I've already done and it would make the code more difficult to maintain. I'm also not sure where all the text would go? Underneath each photo perhaps?
Cheers, J
Posts: 130
Hollis - thanks for the kind words. Adding a search function to stats.php wouldn't be too difficult although the functionality would overlap with what's already supported by the Gallery Search - something I prefer to avoid. Hacking the existing Search to move away from using the giant page shouldn't be too difficult either although I haven't studied that code.
Cheers,
Jeremy
Posts: 130
bificypdog - what's your website url? I would like to see what you're trying to do although having no postnuke experience myself I doubt I can help without setting it up myself. Send me an email if you want to keep the url private.
I know Grimnar tried to include stats.php using:
This apparently didn't work - something that I keep meaning to look into. Maybe postnuke is trying to do something similar?
Cheers, J
Posts: 130
Thanks Terge - Having spent my software developing life working mostly with corporates it's great to be doing something for the community for fun and to be learning something new at the same time.
Cheers, Jeremy
BTW it would be excellent to see stats.php in 1.4.4.
Posts: 78
Just out of curiousity, but is anyone here being hosted by 1and1.com (the free 3-year plan) and have stats.php working with about 1000 images?
Thanks!
-Stephen
Posts: 135
In my gallery at http://ourphotos.org I got your script working great, thanks. However, as you'll see in http://ourphotos.org/stats.php it removes the navigation back to the main albums and gallery. Is there a way to keep the original navigation too so people can get to the main page without hitting the "back" button?
Posts: 10
First of all: great script and it works fine!
I´ve got 2 questions:
1. Is it possible to change the sort order of the comments? So that it starts with the oldest comments?
2. It would be nice to add directly a new comment to the picture if using the view=comments option. Maybe as a link like [add comment]?
Thanks!
Posts: 82
anyone tried to rename the function in this topimages script?...or is the function itself also edited...?
Posts: 130
Haplo - Terge just renamed the function and it worked. See here
All the function is doing is returning an indication that the image is really an image or an album. I wouldn't expect the underlying code to change, just the function name.
FDFLocke, watch this space
csilkman, on my site I have a html_wrap/stats.header file which provides links to the rest of the site. Checkout the guide at eclecticpixels which describes how to set this up. Alternatively you could always add a simple link to stats.php to get back to your main albums.
Posts: 13
Hey myriagon, I have a question for you. I have a decent understanding of what is going on with the coding of gallery. I have customized the headers and footers in the past, and I have edited the voting options in my own gallery in the .php files. Yet, I am having a problem making your code work.
I think I know where the problem lies, but would like your input. The search function use to work on my site when I first implented it, however it stopped functioning a while back. I don't know what I did to stop it from working. I'm thinking this may be tied into the reason why I can't get your code to work. What do you think?
http://gallery.vaporinc.com/stats.php
Posts: 130
Hey vaporinc, thanks for posting - your problem sounds like the one shoobeedoodoo's has been experiencing.
The search code uses very similar code to stats.php so I'm 95% certain if we can fix stats.php then we could get search to work too. I believe shoobeedoodoo's problem is resource related. Is there any chance that you are also hitting a resource limit imposed by your ISP? I suspect as you have added more photos at some point you have hit a resource limit stopping search from working and now you have the same issue with stats.php
I would like to add more debug code to stats.php to tell me how far it's getting before failing. I will do that first thing tomorrow as it's very late here now. One experiment you could try is to setup a test gallery with a test set of albums. Then try deleting some of the photos to find if/when stats.php starts to work.
Hope that makes sense,
Regards, J
Posts: 130
You could also try adding the following code near the top of stats.php to check some resource limits:
Cheers, J
Posts: 130
vaporinc - I have now added some more debug code - try the latest version of stats.tar.gz
You can see the debug info by using stats.php?type=views&debug=2
Regards, J
Posts: 27300
myriagon,
I have tried the latest version (1.7.1) and find it great except for the comments. Fine in Mozilla but in IE the comments sometimes go off the right. I see from the code you have a workarround for IE. What was the reason?
On your site and another it looks fine except comments.
I have restored the custom wraper files I was using; and it did not fix the issue.
I have also tried on 1.4.3RC1 and all the rest function fine.
http://langleycom.com/g1/stats.php?type=comments (1.4.3RC1)
http://langleycom.com/gallery/stats.php?type=comments (1.4.2)
Ideas?
Also in the next version can you add another config for having a comment link (off/on)
Thanks,
Dave
Posts: 130
Hey Dave,
The reason for the hack was an attempt to fix the problem you are seeing with IE. Unfortunately nasty hacks have a habit of coming back to bite later. If you set
$numReturns = 1;
rather than:
$numReturns = 0;
then I suspect the problem will go away - however this is not the right answer.
I really need to understand what is going on here. When I was writing that code I found that for IE only, the comments went off to the right as you are seeing. I tried lots of variations to make it work. The only thing that I found that worked was to count the number of rows (views, upload date, etc) that have gone before and add a <br> for each one. It was almost as though IE wanted a terminator for each of those rows. Strange...
I wonder if there's something in your skin that is causing the difference between your site and mine? I will try some more tests today to see if I can find the right solution.
Thanks for the code to add a comment. I was going to do that this weekend and you have saved me some time now
Thanks, Jeremy
Posts: 130
There's a new version of stats available here. For a demo check out my site
Dave - I have fixed the problem with the comments. I had the right idea with that nasty hack using <br>'s. The correct solution is to use <br clear=all>. I have also added the [add comment] link. You can control this from the url using sac=0,1 or by changing $showAddComment in the code.
FDFLocke - I've added a variable $newestCommentsFirst to control the comment order. By default this is set to 0 so it will list oldest comments first which I prefer now and the way you suggested.
RaVen - I have added code for your suggestion about overriding the photos per page (ppp) and total number of photos (total) from the url. For example stats.php?type=date&ppp=5&total=20
If anyone has any other ideas or problems then please post here and I will see what I can do - I'm still thinking about adding voting - maybe that will be next.
Cheers, J
Posts: 26
Fatal error: Call to undefined function: isalbumname() in C:\xampp\htdocs\postnuke\modules\gallery\stats.php on line 193
(local Webspace)
STATS-Version 1.72
Posts: 130
bificypdog - if you are using the latest rc then that function has been renamed. Try reading back a few pages or look here
Posts: 26
Thanx.
I replaced all "isalbumname" to "isalbum" in stats.php.
It this right?
But, if entered "stats.php?type=views" I only see one picture.
(It is my upload-album, where specified users have rights)
I am using apache 2.x, Win2000 Pro
Direct-Link (without Postnuke)
.../modules/gallery/stats.php?type=views
Postnuke-Link: (I added stats.php in index.php)
.../modules.php?set_albumName=&op=modload&name=gallery&file=index&include=stats.php
Posts: 130
bificypdog - I have now added support for 1.4.3. Try downloading the new version (1.73) from here - that should work out of the box. Get back to me if it doesn't.
Regards, J
Posts: 26
I LOVE YOU ;-)
It's working. Thanx-a-lot.
Posts: 26
Next Problem:
I mentioned it before: I am using postnuke.
I added "stats.php" in "index.php" --> $safe_to_include
If I use the absolute path for the gallery, it is working:
But If I use stats.php with the postnuke-syntax, I get an error:
Following Error:
Fatal error: Call to undefined function: _() in C:\xampp\htdocs\postnuke\modules\gallery\index.php on line 155
Lines in index.php
Please, could you help me?
Posts: 26
BTW. I must user the postnuke-syntax. Sorry. ;-)
I can't publish my site with the direct-path
Sorry for my english ;-))
Posts: 130
I know nothing about postnuke but try replacing the "?" before the type with a "&", eg.
That should work - it seems to be ok for me. Good to see you have done some localization. Wish my German was as good as your English...
Cheers, J
Posts: 27300
Damn, I was going to give you a hand with that. I started with some paper and pen but that is as far as I got. You did a much better way than I was thinking!
Dave
Posts: 26
Wow.Cool. How simple.
What can I say: Thanks again.
Posts: 82
sweet...great gallery addon...
BUT, the name= variable is blank in all my urls trying to link to gallery
...but i solved it in the modules.php file (embedded gallery with phpbb2) doing a !empty check
now only the "toprated" switch is missing ;)
EDITED: toprated seems to be inlcuded already, style=votes...or what am i missing...
thanx
P.S. using Gallery 1.4.3+
Posts: 82
probably already discussed...but what about cache...or do this script have to search through all images every time...load time for big galleries??
Posts: 130
Haplo - that's a good point about caching. Performance is something that I've been concerned about since I started doing stats.php. I'll have a look at what's involved. It should give me experience of the php file system functions too which would be cool.
For those asking about voting, I had a quick look at the Gallery rank and critique types of voting. Anyone know an easy way of deciding the voting order across all the albums? I could get an average score for each photo or add all the points together for each photo. Either way will be slow and ideally need a caching solution. If I go with the average solution then a photo which has 10 "Very Good" votes would rate lower than a photo with one Excellent vote. That doesn't seem right. Also if you have a vote category of Poor (1 point) then this could make a photo that has a Poor vote appear better than a photo with no votes. Maybe photos with no votes should be excluded from the list. It would be a easier if people could give a vote to the photos they like and not worry about rating them too with the "Excellent", "Very Good" etc. Thoughts anyone?
Cheers, J
Posts: 27300
myriagon,
I think the voting in Gallery needs to be rethought altogether. The ranking system is not user friendly. The results are not very clean looking. That is the reason why I, as well as many other users have not implemented the voting in Gallery.
I think the one click option, like on your site, is a much better idea. Very user friendly and much easier to count and the results page looks like the rest of the pages. Very nice.
Just my 3Bahts worth.
Dave
Posts: 47
I find that more people vote on things than comment (less time consuming I guess), so that would be really cool if you could get it working.
I think that what you're talking about is very true- and I would be torn on the issue as well. For me at least though, I think that a "votes" list based off of the number of votes on an item would end up looking an awful lot like my "most viewed" stats. If you're going to base it off of the votes, then it should be off of the highest ranked ones. Users will go in there and adjust what they like and don't like accordingly. It just seems like that would be going "all the way" for that feature- why spend time making something that's going to look like what you've already created? I also really like the idea of adding all the votes together to make a "big" vote number... that's definitely a good idea too. Do you think you could have it show a tally of all the different types of votes it received too?
Also, I don't know if you can adjust the number of vote options for each sub-album...? If so, that might be a snag for you.
Here's another idea too- how about implementing a "random items page" option on there as well? You could implement the IFrame random block or similar. Here's an html page I made with lots of random blocks: http://webhollis.com/random.html
It's so cool that this feature is still growing! I'm going to keep an eye on this thread.
Later~
Hollis
Posts: 82
i do not think iframes are needed (honestly those are ugly as...), since the stats script may exract and display images by itself...a rand is all thats needed...
votes:
agree with some of you, the gallery votes are messy and not very intuitive...hopefully the gallery team will think twice for G2
but since we're stuck with current implementation, a toprated list should extract images based on average vote score...with a cut off for let's say less than 2 votes (defined with a parameter)...
for example
Image XXX
Ratings: 2.76 / 5 (7 votes)
cache:
a must someday...maybe that gallery-rand script could be mimicked...it has cache ;)
anyone tried this stats script for really huge galleries...what load time are we talking about?
Posts: 15
Haplo, I use this script for a gallery with about 6000 pictures and it is slow, but not painfully so. In the end I think I am the one to blame for it being slow anyway since I am running my webserver on a 266 :]
/Jenny
Posts: 82
lol...yea...but im glad to hear its working "ok" for such a big gallery on such a "server"...
...but implementing toprated would probably need caching since more calculations are needed
Posts: 130
JennyGlad to hear stats is working ok with 6000 images and a slow server. I was pleasantly surprised when I saw a site that was loading in about a second with 3000 images. Thinking about how it works, the number of files that are loaded depend on the number of albums you have. Of course with more images the amount of data read from files is larger and the sorts will consume more time but that should be in memory. Caching should make a significant performance benefit but for a site that loads quickly already I would keep caching off. That way the information displayed is always up-to-date.
Dave - agreed about Gallery voting. I hope the Gallery team have a rethink. It would be cool to get my simplified voting included in Gallery. stats.php came out of my work on simplifying voting. Initially stats.php only supported voting. I'll have another rethink about what's involved in doing a Gallery patch to support the simplified voting.
Cheers, J
www.tearoom.me.uk
Posts: 82
also, we need
- latest/updated albums
and more style parameters: x columns, text below image etc...
EDITED: it really bugs me im not that confortable with the gallery way of handling things...db approach is soooo much easier to understand ;)
Posts: 130
Hollis - I like the idea of random photos. Your implementation already looks very good. Maybe when I get some time I might implement it in stats.php as it would be good to get that on my site.
Cheers, Jeremy
www.tearoom.me.uk
Posts: 47
Well, it's actually just an html page, so feel free to grab and modify it to your needs (you will obviously need the random block iFrame php files).
Here's another idea- how about "most comments"? I've seen some pretty good threads going on individual photo's pages. Later~
Hollis
Posts: 82
ok, here we go
i've done some addons for the script:
NEW TYPES
- random album // display random album (highlight Pic), type=rand_album
- random image // does what it says, type=rand_photo
- latest albums // display latest albums (highlight pic), type=latestalbums
NEW STYLES
- layoutInfoBelowImage // i prefer having the text info BELOW the image, so this is a switch for doing it ;)
- showAlbumOwner
NOTE: I've developed this script further for usage as a block within the mx-portal environment...so there may be some typos when reverting back to standalone code...please report back any issues and i fix it asap
EDIT: seems to be working
NOTE2: the random image is found by first selecting a random album, and then selecting a random image within that album...this means images in large albums will be less frequently selected...but why not ;) ...the reason why is to stick closely to original code and modify as little as possible....
ENJOY
History:
ver. b
- beta
ver. c
- fixed typos and added showAlbumOwner switch
ver. d
- some code cleanup, no feature changes
ver. e
- typo on line 50 ;)
ver. f
added function for average rating -> topratings...not efficient code but working ;)
Posts: 27300
Very nice.
A couple of points.
1. Have the ability to show or not show the album owner.
2. When $layoutInfoBelowImage == 1 have all information center or left not just the image.
3. $gallery->html_wrap['frame'] = the same as the frame that is set in config for images or albums depending on what you are viewing.
4. Typo in the readme: $type == "rand_photo" Random Pics" & $type == "rand_album" You forgot the underscores.
Now the BIG question is there going to be 2 maintainers of stats.php? Will Haplo and myriagon likely integrate each others changes?
This thread is getting verrrry long and perhaps a version 2 should start it own thread when Haplo and myriagon agree?
Dave
Posts: 82
1) will do
2) will consider, since i normally use the script for portal blocks never wider than 200 pixels = looks nice as is
3) do not follow...what?
4) will fix
im was not planning to maintain this code...i was hoping myriagon would accept my addons and intergrate to main stats.php
but we'll see when he's given some feedback
Posts: 13
Sorry it took a while to get back to you. I think you are correct when you say it is a memory issue. I updated stats.php with your new version. And it appears when debugging it, it only recurses 76 of the 168 albums. Any more ideas? Or is this most likely a server-side issue.
http://gallery.vaporinc.com/stats.php?type=views&debug=2
Posts: 27300
haplo,
In config.php there is some vaiables set for different frames:
$gallery->app->default["album_frame"] = "notebook";
$gallery->app->default["thumb_frame"] = "dots";
$gallery->app->default["image_frame"] = "shadows";
These veriables can be overwriten and different for each album.
Presenly the code is hardcoded with $gallery->html_wrap['frame'] = "solid';
Now that you have added the album capability it should use the album image frame. So:
$gallery->html_wrap['frame'] = $gallery->album->fields['image_frame'];
But then again I would not want different frames around the images pulled from different albums.
So I guess I would like to have the same frame wrapped around the image as the album IF all photos are from the same album else a default frame as is now.
I hope that makes more sence.
Dave
Posts: 82
a....ok...follow....another switch on/off it is ;)
Posts: 58
other problems with random are that if you have an album that in it only has subalbums it generates no picture found in random album. It also has the same problem with albums.
Posts: 15
Hi!
I have been playing around with this script since I want to add a functionality that'll take the arg "time" and display all pictures that was taken that specifik day or month or year. Since I am very new to php I can't figure it out. Please help if you find it to be an interesting idea ;)
/Jenny
Posts: 82
i know
and has hinted in the code that "error mess" is a temp soloution
problem is i didn't want to modify original code too much, and original code firts loops through all albums, then inlcuded photos for each album
but i will add a check to validate if the album contains photos or not before proceeding
and then clean up the code ;)
hang on
myriagon:
it concerns me im flooding your thread with my own addons to your script, please let me know if i should step back...but i feel its important to keep the mod in one place or else we'll get multiple instances and noone knows what's been fixed in what version...
...like this guy tmothy
http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=15508
http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=15454
anyway, whats left is a working votes toplist and validation when albums contains no photos...