Hi,
It will be nice to have random album covers (thumbs).
It will be nice that the thumbnail image for the album is a random image selected from all the images in all the sub-albums of that parent album (if in the album only subalbums (and in the subalbums are pictures) the album pictures will taken from the subalbums random).
Is there any option for this?
I tryed to code it by myself.
But i get it only work with all the images (from other parent albums to) and not the above option.
Greets Kees.
Posts: 27300
There is no option for this at this time.
For discussion: I guess a module could be developed with some JS to replace the existing cover/thumb with another thumbnail in the album.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 64
Is there any update about this request?
Or does anyone knows how to code it by myself (the sql query).
Greets Kees.
Posts: 722
Untested, but maybe something like this:
$album_id would be the id# of the parent album.
Posts: 64
This is the original code, how i have to place the above code?
if ($child->is_album() && ($rnd = item::random_query()->where("parent_id", "=", $child->id)->find()) && $rnd->loaded()):
Greets Kees.
Posts: 722
I would do something like:
Posts: 64
It don't works.
Here is the whole code maybe it will help:
Posts: 64
Is there any news about this?
There must be people who miss this option i think
Posts: 27300
This seems to work but has some lag. Perhaps I can make it a bit better moving the code up a bit but this is a proof of concept first....
add
just after
<?= $theme->thumb_top($child) ?>
in gallery3/themes/yourtheme/views/album.html.php
test and let me know.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 27300
How about the attached module?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 76
Dave,
excellent work - love it! Installed it and tested on one gallery so far.
Is there a setting option - so that some albums will be exempted?
Many Thanks
Posts: 64
Many thanks for trying
It works a little bit but not correctly.
See it on www.mydigitalworld.nl
Sometimes there are no thumb present but only a text with the album name.
You can try it to refresh some times
Second problem is that when a album has sub albums (as example the album vakantie) it don't work.
If a album has only sub albums it will be better that the thumb of the parent album will be 1 of the sub albums thumb.
When you have only pics in the album (without subs) it works ok.
This is the code:
Greets Kees.
Posts: 27300
Not yet. How do you want this setting? Number of items in an album? or album specific? How do you propose the UI to work & look like?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 27300
Knorde,
I saw that missing item every once in a while and don't know why the $rnd variable is not used as I put it in a loop of 5 time in a do loop to set it as the item::random_query() is not 100 successful. I might have to come up with a different way.
Try the module not just the code snippet I posted.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 27300
So we don't want to randomize the cover if there is only sub-albums in the album?
I need a better user story to understand.
As more and more checks are added it is going to slow down so we much keep that in mind.
I don't want to randomize 1000s of item in sub-sub-subalbums as well as that is one big query and might take some time to do, slowing down the UI.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 76
Dave,
my own personal thought is that each album can opt in or out of the random image - just like we had in G2.
So that if you have an album with 2 sub albums. one album can have the random item from an image inside it and the other album can have a fixed non random image. Then the top album will pick from the two album covers and use that as it's cover.
as for how to do it - I dunno - my coding skills are non-existent, sorry. Could the UI be in the album option menu for each album?
Posts: 64
Ok now i used the module only (and not the code) but i see the same effect as i described above
Posts: 64
Ok i understand but in that case the parent album has always the same thumb and will never be another one.
As example:
Parentalbum "Vacation" - Subalbum "2012" - Subalbum "Italy"
-------------------------------- Subalbum "2011"
-------------------------------- Subalbum "2010"
It will be nice if the thumb of Vacation will be random from the subs or newest one or something.
If it is a fixed one, it will always be the same after years
Posts: 27300
Choose your own at any time.
I will think how to make this a bit better without making the code complex to support or slow down the site.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 27300
The two albums with no highlight only have one item it it.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 64
Now i have placed extra pics in (as example) Auto.
But same problem (maybe you have to refresh some times )
Posts: 27300
Added some code to check in $rnd is set. More upgrades to come....later
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 64
Ok tnx, where can i download it?
Posts: 27300
Updated to version 2.
Added an admin setting to choose sub-albums if desired. Might cause some performance issues in larger galleries.
It should not change the thumb if the random code fails.
Still thinking about the best way to eliminate some albums from randomization.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 76
I get an error occurred while installing for version 2.
I tried to upgrade first and got the error. Then I un-installed the module deleted it with ftp and uploaded v2. installed it and still getting the error. It hasn't effected the thumbnails as far as I can see they are the ones I picked before trying this module.
Thanks
Posts: 64
I get an error while installing the module.
"Er is een fout opgetreden bij het installeren van de module Random album cover - highlight".
It means it will not be installed because there is an error
Posts: 27300
Not sure why you got an error but have attached version 3 that now includes 2 new features:
Edit album and you will be able to disable the random highlight to that specific album.
Added an admin setting to include sub-albums in the random highlight image selection. This might be a bit of a performance hit in large albums.
Later this week I will create a codex page.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 64
Hi Dave,
This is exactly what I wanted, perfect!
Thank you!
I only have one more little thing (but this is not something to the module).
I have changed the code in the album.html.php so the pics has the correct ration portrait or landscape.
If I use the original album.html.php the random module works fine but with the custom album.html.php it does not work correctly.
Maybe you know what I would have to change to get it working on my code?
The code is below.
Posts: 27300
What do you mean by not working? I'm assuming that the image is distorted as different images are used?
Is the code you posted the whole album.html.php?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 64
I don't use other pics.
When i use the custom album.html.php the ration (portrait or landscape) isn't everytime correct.
And randomize subalbums not working then (see Vakantie).
You can test it to refresh some times
When i use the original album.html.php the random module works perfect only in that case i have not the right ration (portrait or landscape).
Below is the whole code from my custom album.html.php
Posts: 76
Dave,
looking great - working on one install already - 3 more to go when I get time.
Thanks You so much!
Shug17
Posts: 27300
Is this customization for random album highlights? You cson't need a new album.html.php to accomlish this as the module will do it for you.
Is there some special customization? If so what is the customization suppose to accomplish?
Do you need the custom file? If so why?
What theme is that so I can test with it?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 27300
Also viwing the source of your page the Vakantie thumbnail never changes as the class to the image changes for some reason.
<img class="g-thumbnail2"
where does the 2 come from?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 27300
Is this:
part of the original theme?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 27300
Your theme or your customization need some work
notice the 2 closing </a> tags:
I would suggest using the original theme code and report back your findings.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 64
The theme is browny_wind.
For every different screen resolution i use a different css file.
In every screen resolution .css (1024x768.css and 1280x1024.css and 1360x768.css etc. etc.) i have the code:
The result is that every screen resolution has a nice site resolution.
g-thumbnail and g-thumbnail2 is portrait or landscape.
The above code is not a part of the original browny_wind theme.
I have made it by myself.
The code works perfect without the random module.
This is the original album.html.php
Posts: 64
Above that is the <a> look:
Posts: 27300
I works just fine without your customization's as well i bet.
I'm not going to debug your theme in this thread. I just saw two closing </a> tags when viewing the source.
OK for your custom theme see if this helps:
Replace the code_thumb_top.html.php in my modules view folder with the above code.
Perhaps a better JS jquery expert can chime in if getting the selector above to work with g-thumbnail and g-thumbnail2 to work without selecting too much or too little.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 64
Hi,
The random module works but the pics are in incorrect resolution sometimes now (portrait or landscape).
When i turn the random module off the resolution (portrait or landscape) is always ok.
I think the problem is that in the random module code i only see g-thumbnail and not g-thumbnail2.
No idea :P
Posts: 27300
Your site is down now so it is hard to diagnose your theme issue.
Can you give me a clue? Seems your theme changes the size of the thumbnail and perhaps the JS code to replace the thumb has different size than the attributes it is replacing.
Anybody else have a issue? or is it just this customized theme?
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 76
The module works really well and is so easy to use.
Huge Thanks
Posts: 27300
The jquery selector:
#g-item-id-<?= $child->id ?> img[class^=g-thumbnail]
says:Select the id of g-item-id-XXXX where XXX is the id of the album then choose the img with a class that starts with g-thumbnail
So any image in a <div> with the id of g-item-id-$child->id that has a class of g-thumbnail or g-thumbnail1 or g-thumbnail2 should be swapped.
^=
is the key that basically says starts withI hope that helps in understand how it gets swapped.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 27300
@knorde, your site is still down to diagnose.
@shug17, Glad it is working. Got some suggestions to flesh out the docs> http://codex.gallery2.org/Gallery3:Modules:random_album_highlight
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 64
Don't know the reasson but the error log says:
Premature end of script headers: index.php
I have nothing changed...
Hope i can fix it...
I think this is the problem, my host has upgraded the php version.
http://www.directadmin.com/forum/showthread.php?t=39820&page=1
(Gallery 3 does not work with php5.3.6 and suPHP)
EDIT
My host has not upgraded the php version.
http://kene.nl/phpinfo.php
Don't know now what to do
Greets Kees.
Posts: 64
Ok now i have re-installed the whole site.
The site is back online now (don't know what the problem is but np.
I hope you can diagnose now
If you need it i can give you ftp access.
Greets Kees.
Posts: 27300
knorde,
With your custom theme and some custom JS for your page, perhaps this module is not compatible with your customization.
You are more familiar with those customization (re-sizing the thumbs) so if you have recommendations to work around those, please let me know and I can most likely accommodate them.
I'm not prepared to work on some JS/theme customization I'm not familiar with.
Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team
Posts: 64
Finally it works now, it is difficult to say how the code is now (i had to change more files) but it works now perfect!
Many thanks!
Greets Kees.
Posts: 1
Hey Dave,
I was searching for an option to implement some random album covers. I installed what you suggested, and it worked great for me on my gallery.
Thanks for sharing,
Chris