I've been spending some time recoding the Fast Gallery module, all starting with trying to resolve this issue and this issue. Along the way, I started fixing this and that, and then got a bit carried away. So here is the result, including fully-working sorting options, customizable title and path alias, customizable caption format, caption labels, and more. Attached screenshots.
Documentation included. Please take a look at the README and the help section.
IMPORTANT
Please fully DISABLE and UNINSTALL any previous versions of Fast Gallery. I did not write any update code because this is not an official release. This version uses a slightly different database schema and a few different variables. Please make backup copies of any important files, and try out the module first on a test site if you are able to. I consider this code to be in alpha stage. It's functional but not fully tested.
If you need to edit EXIF data in JPG files, I have been using and highly recommend EXIFManager (http://phgiraud.free.fr/exifmanager).
Enjoy!
-nick
ADDITIONS
---------
- Support for folders within folders with no images
- Custom caption display; up to 3 fields. Choose content of each field in a
dropdown on General settings page. - Support for Clean URLs.
- Dropdown selection choice for Lightbox slideshows.
- Support for setting custom title and custom path alias.
- Updated CSS sheet for different look and adjusted layout.
- Support for case-insensitive file type extensions.
- Support for displaying images with no EXIF data (i.e. all non-JPG files).
- Also now includes JPG files with blank EXIF data.
- Sorting for when hierarchy is disabled.
- Graceful error handling (error message) for unsupported filetypes for internal cache (just BMP right now).
- Error handling for non-existent directories in URL path.
- Option for selecting no Javascript framework. Links go directly to
images. Thickbox and Lightbox will now only display as options when they
are installed. - Spaces in URL path get changed to underscores.
- Corrected code for generating internal cache thumbnails. Now handles
square images without distorting them. - File fast_gallery.admin.inc to separate code for settings pages
- Help page, more help text in settings pages, README.txt, and this
CHANGES.txt file. - Setting number of images per row. Required to fix layout of overlapping
images with captions. - Rewrites of functions, code blocks
- Code commenting throughout.
- .pot file for translations.
ISSUES ADDRESSED
--------------------
- #316338: Does not recognize a new folder with PNG Files
- #313456: Folders aren't included in count of "Amount of images per page"
- #315352: Internal Cache Only Works with Lowercase Image Extensions
- #309231: Fast gallery block only reads images from one album
- #299430: fast gallery block not finding the correct images
- #314206: Sort by Date Taken Incorrect
- #311563: Folders in Folders with No Images Don't Show in Hierarchy
- #315957: Only works when Hierarchy is disabled
- #315701: Error creating .pot
- #315852: Custom gallery title to be set in options-page
- #315849: Adress-field does not update according to path-alias
- #313858: Help getting this installed please
- #314080: No pictures found.
- #293857: Image caption not working in thumbnails
- #314519: "Is not folderimage" displayed
- #310620: Make random block link to gallery the displayed image is in
- #284539: Lightbox2 caption not correct.
- #284530: lightbox2 display option
- #281919: lightbox2 integration
Comment | File | Size | Author |
---|---|---|---|
#48 | fastproblem.png | 108.02 KB | pimentoski |
#30 | jan.png | 27.66 KB | jan.n |
#29 | fast_gallery_alt_alpha-1.1.zip | 33.48 KB | ncy |
#14 | fast_gallery_alt_alpha-1.0.zip | 33.22 KB | ncy |
#12 | fast_gallery_alt_v4.zip | 33.21 KB | ncy |
Comments
Comment #1
ncy CreditAttribution: ncy commentedhere's a pic of Lightbox in action. there were some posts about Lightbox not working right, but it works great for me. slideshows work too! :) (p.s. i did have to edit the lightbox.css file a bit to position the buttons correctly).
Comment #2
lomz CreditAttribution: lomz commentedThanks, this is by far the best gallery module to Drupal
Comment #3
tompte CreditAttribution: tompte commentedHello
I've try this version on one web site and it work without problems, great job !
On a second web site I have some problemes:
after configuring the module I clic on the link to show the galleries and I have this messages: see message.png
It look like the temporary tables are not created.
I've check the rights on mysql for this database and all the right are good (see mysql.png)
What can I do to find where is the problem ?
Drupal 6.4
MySQL: 5.0.32
Comment #4
tompte CreditAttribution: tompte commentedHi
I've found the problem:
In fast_gallery.class.php when you create a temporary table it's without the prefix (see in http://api.drupal.org/api/function/db_query_temporary/6 ).
then when you want to read this tables you must not put {} around the name of the table.
voilà
A second problem now:
My drupal is in a subfolder: drupal
when I clic on Fast galleries on my menu I have the first level of my galleries (http://xxx.xxx/drupal/fast_gallery) OK
If I clic on this first image it send me to http://xxx.xxx/drupal/drupal<?b>/fast_gallery/events and so on for each level!!!
OK I've found a solution for the second the problem, see the attached file for a version with a correction of the tow problems
Best regards
Philippe
Comment #5
ar-jan CreditAttribution: ar-jan commentedCool this works! However, when I click the thumbnail for a folder, it links to the adress like this:
http://mysite.com/ttp%3A/%252Fmysite.com/galleries/my-first-album
When I delete the incorrect part that has been added after the domain ("ttp%3A/%252F"), the gallery works, lightbox also works.
Philippe, thanks, your patched version in #4 solves my url problem too.
This now works on both my local testserver and the live server, very cool! This will be a very effective way of managing albums.
Comment #6
ncy CreditAttribution: ncy commentedgood finds Philippe! the base_path also needs to be fixed for the random image block code.
thanx for finding the SQL brackets problem, too. i learn something new everyday :) temporary tables are created for when Hierarchy is turned off, too. fixing that code now as well.
attaching version 3 of alternative version!
Comment #7
tompte CreditAttribution: tompte commentedHappy that's help !!!
Thanks for your module is really usefull
Comment #8
Kiphaas7 CreditAttribution: Kiphaas7 commentedHi there,
I just tried this alt_v3 version, and it worked a lot better for me, but with hierarchy enabled, it shows no list of directories... Flat view works without a problem, but I eventually want to move this from a local test server to a live site, which has a lot of pictures in a lot of subfolders.
What it does show is an empty page, with only inside the div #fast_gallery are few div's with .clear followed by a br, and the pager, containing the exact same amount of pages as it would with just a flat view.
- Tried imagecache and internal one
- Tried adding pictures in the "root" gallery folder, didn't change anything
- the map name contains spaces, numbers and capitals, allthough I tried removing the spaces, numbers and capitals, and that didn't change anything.
- Friendly urls are on, turning them off didn't change anything..
So, again troubles with hierarchy... :(
Comment #9
ar-jan CreditAttribution: ar-jan commentedHm, I haven't tried the difference with this version, but what happens if you set the "sort by" to "name" for all sort options in Advanced?
Comment #10
ncy CreditAttribution: ncy commentedhrmm, that is strange that it would have the same number of pages as in flat view (unless it's a coincidence that the numbers match up? the code should be doing 2 completely different things for flat view and hierarchy.)
here's some quick brainstorming:
1. glob() is used to explore the directories, but it isn't available in some systems. is it possible for you to upload it to the live site in a test location? maybe it will work there.
2. did you have any previous versions of Fast Gallery installed? make sure in go to Modules, disable it, save. then click on the Uninstall tab, check off Fast Gallery, and Uninstall. if i recall correctly, the uninstaller code for the 2.3 Fast Gallery misses a few variables, but i think the most important thing is that the database schema is updated.
3. try doing Clear DB and Rescan? refresh the browser page?
4. try with 1 or 2 folders first, and slowly add to it. maybe there's just one folder or image that it's choking on? unfortunately i haven't tried any large scale galleries yet. how many images are you working with?
5. any special characters like umlaut in any image or folder names? unfortunately, those aren't handled properly right now.
6. do you have more info about your setup? particularly, what is your folder hierarchy structure and where is each image located.
7. can you take a peek into your database and see if the fast_gallery and fast_gallery_exif tables look like they have good data in them?
any information helping me to duplicate the problem on my setup would be great.
that's all i can think about right now. hope we can get to the root of this problem. post back if you find out anything new. i'll try to help as best i can.
thx
-nick
Comment #11
Kiphaas7 CreditAttribution: Kiphaas7 commentedWow, fast reply :).
I'm using a xampplite install on a windows machine, and the live site is also on a windows machine, allthough it probably doesn't use xampp :).
1) is there a way to test/check for this? I have complete control over my local install...
2) Yes, but I disabled them and uninstalled them.
3) I always do that after changing settings. Clear DB, rescan and CTRL F5.
4) There is atm only 1 (sub)folder, containing 30 pictures, all in the format of DSC00001.JPG. Next to that subfolder, there are some testpics in the root folder. Those were added later, after I discovered that hierarchy didn't work for me.
5) No, and that won't be an issue for me. :)
6) I have my images located in the drupal root folder. Clarification: "path to gallery = foto/" for me. Inside that foto gallery, there are some loose images, and 1 folder, all lowercase, nothing special. Inside that folder are 30-ish images in the format of DSC00001.JPG.
7) Both those tables exist, and there is data in them. Data looks good to me. The only thing that looked strange to me, is that in the path contains both slashes and backslashes ( example: foto/subfolder\DSC00001.JPG ). Also, the parent field is empty for all my entries. Could the windows backslashes be it?
EDIT:
Skimming through the readme, I stumbled upon this:
* Filenames are treated with no regard to case, so don't give files the
same name.
Does that mean every filename needs to be unique, regardless of where they are? That would possibly be a big turnoff for me, as most files are straight from the camera, and don't have fancy filenames. So there could be dupes in the live site.
At the moment, the live site uses weatimages as gallery. Obviously this is not integrated in drupal, so I was looking for a good replacement of that one. This module has for me the most potential, so kudos for developing a straightforward, do-what-needs-to-be-done module! :)
Comment #12
ncy CreditAttribution: ncy commentedok, yea, i didnt think glob() would be the problem as most systems support it, and it was seeing all the files in the flat view. i think the database definitely is the telling story here. backslashes ("thanx Microsoft") are def a bad thing to have in the path. i'm guessing something with xampplite on Windows is messing with the path.
here's a version that replaces all backslashes with forward slashes before writing to the database. lemme know if that works better.
also updated the readme to clarify that filenames can be the same, as long as they're in different folders. files are identified by pathname, so the important thing is that 2 files have different paths if they are to have the same name. folders, on the other hand, are identified by its name alone, and its location is determined by the name of the parent folder (no path information). so folders can't ever have the same name regardless of where you are in the hierarchy.
cheers,
-nick :)
Comment #13
Kiphaas7 CreditAttribution: Kiphaas7 commentedWell, that fixed it only for a little bit. I uninstalled the module, flushed the caches, reinstalled v4. Still no bueno with hierarchy.
The only change is that there is no longer a pager in the sourcecode of the generated page. The page still consists of clearing div's and an (now empty) pager div.
In the database the backward slashes are indeed turned into forward slashes, BUT, the "parent" field is still empty for all images. What should be in the parent field anyway, the subfolder name?
EDIT: also, small fix suggestion: you use <br>. Most drupal themes are xhtml, so it should be <br />. If there really is a need for xhtml, is a totally different discussion, but the point is that we're stuck with xhtml, might as well conform with it :). With that said, is there really a need for a clearing div AND a br?
Comment #14
ncy CreditAttribution: ncy commentedwhoops, my bad. i didn't realize that ALL of your parent entries were blank. that can also be attributed to a backslash problem. the parent is supposed to be the parent folder of that image/folder.
i'm renaming this zip as alpha-1.0, so i dont keep numbering up to v100 or something like that. when rapsli gets back from his vacation, maybe he can get this committed to CVS.
i changed the 2 places i use <br> to <br />. i'm not sure what to substitute the clearing div with. i'm not a CSS guru, and it's the only thing that i could get working right (to clear everything and go to next line). it's used to go to the next row. i inserted the <br /> just to give it some more space between rows.
-nick
Comment #15
Kiphaas7 CreditAttribution: Kiphaas7 commentedAnd it works now. :) Many thanks!
@br:
In your case you could give .single-image some extra bottom-padding.
Comment #16
ncy CreditAttribution: ncy commentedcool beans, glad to hear it's working now :).
yea, i guess a "margin-bottom: 1em" has the same effect as adding a <br>. i think without the clearing div the padding/margin wasn't working. me thinks somewhere in my fiddling i left it as a <br> instead of changing it back to CSS :P. is it a bad thing to have an empty div with just the clear in it? that's the thing i found i couldn't find a work around for.
Comment #17
Kiphaas7 CreditAttribution: Kiphaas7 commentedShort story: It's the most stable work around. There are more elegant solutions, but enough time to worry about that later. :)
So, I moved the module to the live site, but guess what, more problems! :) Now the pager stopped working, it shows exactly the amount of pictures it should on 1 page, but no pager to different pages... And there are more pictures, of that I'm sure :P.
Seriously though, somehow magically the pager stopped functioning...
As a feature request: Could you make the folder list an item list?
$output = theme_item_list($tmp, NULL, 'ul', NULL) . $img_output;
instead of:
$output = implode(' | ', $tmp) . $img_output;
Another feature request: breadcrumbs while navigating through subfolders. Would be cool. :)
Comment #18
ncy CreditAttribution: ncy commentedhrmm, lemme think on this a bit ...
when i had pager problems, it was because the sql_count query was getting screwed up in the pager_query() call, and it did exactly that, show only 1 page of pictures. but assuming that the database only stored forward-slash path data, the explode('/', ...) calls should be working correctly ... can you double-check the database on the live site and tell me what's there (any more backslashes?).
the theme thing makes sense. i'll def do that in the next update. it'd definitely make it easier to theme the look of text-link folders.
breadcrumbs aren't there? i do construct a breadcrumb and set it using drupal_set_breadcrumb() ... are you remembering to print out $breadcrumb in your theme? that's the only way to navigate around albums through different levels.
Comment #19
pimentoski CreditAttribution: pimentoski commentedgood work, but i have one problem, the special characters from the Portuguese language like "ç or à or ó" does not appear but if i go to mysql and do the update, then it works fine.
Comment #20
Kiphaas7 CreditAttribution: Kiphaas7 commentedWoops, yup, breadcrumbs are out of my (custom) theme. I added it in the module for myself, since I don't need the breadcrumbs sitewide. :)
I'll also look into the pager stuff.... So far the tables look allright, all the fields have entries, and no backslashes, but I'll examine them more thorough.
Comment #21
Kiphaas7 CreditAttribution: Kiphaas7 commentedI found a (dirty) solution for the pager problem:
// We need to specify a count query for pager_query()
//'.($result->num_rows + $result2->num_rows - $extra_count). '
$sql_count = 'SELECT COUNT(*) FROM fast_gallery_all_images';
This works for me....
Comment #22
ncy CreditAttribution: ncy commentedi wonder why the pager_query is choking on your gallery :/
the problem with
is it ignores the number of folders, which is that i was complaining about in this post. :P
also, because the images are selected by folder, the images that are supposed to only represent folder thumbnails be counted are images in a folder, when they shouldn't be counted -- so you might end up with more pages than you expect, or a blank page at the end. that was the adjustment of subtracting "extra_count". these "extra" thumbnail records are necessary in the database to workaround this problem.
your code change is actually equivalent (or should be equivalent) to:
does that do the same thing for you? did you pinpoint the problem down to that SQL count line of code?
Comment #23
Kiphaas7 CreditAttribution: Kiphaas7 commentedI used print_r($sql_count), and that returned 0 for me while in a gallery which should have multiple pages. "extra_count" also returned zero, so I knew something went wrong with the counting of the rows. I just didn't know what :). After talking about it with my fellow siteadmin, who knows more about sql commands, but less of drupal, he suggested this and it worked. I realized that it didn't exactly do what you wanted it to do.
I'll try your code in a few hours and report back.
Comment #24
Kiphaas7 CreditAttribution: Kiphaas7 commentedAfter changing it to your code
$sql_count = 'SELECT '.$result->num_rows;
it gives me the following error:
And no pager. :)
Comment #25
ncy CreditAttribution: ncy commentedalrighty, let's try this mess of a SQL call instead :D
i'm guessing your server doesn't like the num_rows property ... either that or it doesn't like 'SELECT x' calls, where x is some arbitrary number
Comment #26
ncy CreditAttribution: ncy commentedi'll try to look into special characters when i get back from traveling. i'm going to be out for about 1-2 weeks.
Comment #27
Kiphaas7 CreditAttribution: Kiphaas7 commentedYup, that works. Thanks :)
Comment #28
lomz CreditAttribution: lomz commentedWhen will the alternative version become the official?
It is already better.
Comment #29
ncy CreditAttribution: ncy commentedrapsli (Raphael Schär) is the original author and maintainer of this project. he made a post about 2 weeks ago that he was going on vacation for a few weeks, so probably soon.
i'm posting an alpha-1.1 version with the said changes above.
cheers,
-nick
Comment #30
jan.n CreditAttribution: jan.n commentedncy: Thank you for your work!
The German characters äöü are not recognized in this version, the remainder of the text is cut off (also in lightbox), cf. attached picture.
The caption should read "Ganz schön eng hier"...
Regards
jan
Comment #31
Kiphaas7 CreditAttribution: Kiphaas7 commentedWhen just rescanning the gallery, my images got added again to the db. This is another consequence of the backslash problem, and it's fixed by doing this:
:)
Comment #32
Thurgi CreditAttribution: Thurgi commentedI tried to install the new version but everytime i try to open the galerie it spams me with messages like:
user warning: Unknown column 'filetype' in 'field list' query: CREATE TEMPORARY TABLE fast_gallery_images_noexif Engine=HEAP SELECT path, folder, gid, filetype FROM fast_gallery WHERE folder='galerie' AND filetype <> 'jpg' AND filetype <> 'jpeg' ORDER by path asc
Comment #33
ncy CreditAttribution: ncy commentedjan, i'll take a look at special chars once i get back from my trip. i'm abroad right now.
Kiphaas7, thanx for the find. glad that you're helping debug and test!
Thurgi, if it cannot find the column 'filetype', it most likely means you did not uninstall the old version of Fast Gallery before installing the new one. make sure you disable it first on the Modules page, and then click on the Uninstall tab, and uninstall it. the database schema is different, so you have to completely uninstall the old version first.
-nick
Comment #34
rapsli CreditAttribution: rapsli commentedWas on vacation ... boa... lots happened here. I'll get my head around. I got no problems replacing the current version with this one... give me a couple days.
Comment #35
rapsli CreditAttribution: rapsli commentedMan... I always have to go on vacation if code gets fixed like this :) Good work. I just had a very quick look at it today. For the most part. So, I suggest, I'm going to make this the new version in alpha stage, then I'm gonna have to go through the queue and clean a little bit up. New version should be out tomorrow.
Comment #36
ncy CreditAttribution: ncy commentedthanx :)
Comment #37
pimentoski CreditAttribution: pimentoski commenteda great module and great team work!!!
btw, it's possible to put the image description in the thumbnail view in the bottom of each thumbnail?
Comment #38
rapsli CreditAttribution: rapsli commentedoky. next round is open...
Comment #39
lomz CreditAttribution: lomz commentedHow do I set the discription, I havent found that?
Comment #40
ncy CreditAttribution: ncy commentedComment #41
ncy CreditAttribution: ncy commentedhi,
pimentoski, are you using the latest beta version?
lomz, you can edit EXIF descriptions using EXIFManager (free program): http://phgiraud.free.fr/exifmanager and set it in the admin section for caption display fields (General settings page)
Comment #42
Kiphaas7 CreditAttribution: Kiphaas7 commentedOne more thing, the active class isn't added to my fast gallery menu link when I add it to my primary or secondary links. Could this have anything to do with the module?
Comment #43
ncy CreditAttribution: ncy commentedactive class? what's that?
Comment #44
Kiphaas7 CreditAttribution: Kiphaas7 commentedIt's a css class that dynamically get's added to a link in the primary or secondary menu, corresponding to the page your visiting.
For example, if you're on the page "test", the menu code would show as following:
...providing visual confirmation in the menu to show you where you are.
This works for all my current modules, but yet it fails for the gallery. I was wondering if it was something I did wrong, or that it might be a setting/bug in the module itself.
Comment #45
ncy CreditAttribution: ncy commentedoooh, i don't remember if the active class is set in the code. a lot of links are formed with l() function. i'll make a note of this on the list of things to-do when i get back.
Comment #46
rapsli CreditAttribution: rapsli commentedadded the folderimage feature again -> user has the possibility to set an image to be displayed as folder (just like in win explorer). It's though still not finished.
Comment #47
Kiphaas7 CreditAttribution: Kiphaas7 commentedncy: I did some simple modules myself, and I don't recall setting the active class _myself_. I think it's something with the menu callback that goes wrong.
Comment #48
pimentoski CreditAttribution: pimentoski commentedncy i was not using the beta version... now everthing is fine, but:
- if you change the size of the thumbnail for a smaller size the text (description) will appear before the thumbnail at the left. Maybe if the text was center the problem does not happen . (look attachment file)
- the special characters not appear. If i wrote my first name "André" (like Andrew) it will appear "Andr", if i wrote something like "máquina" (machine) it will appear "m". but if i go to the sql and make and update to the field it works fine... this is very important for me and for all the people that no speak English (German, French, Portuguese, Brazilian, Spanish, and much more all have special characters)
thks
Comment #49
ncy CreditAttribution: ncy commentedhi pimentoski, if you change the thumbnail size, you should update the CSS file's .single-image width accordingly. try that and let me know it that works better.
a lot of ppl have mentioned special characters already, i'll try to have a look at it next week.
Comment #50
pimentoski CreditAttribution: pimentoski commentedncy if i change the css it works fine, thks.
Comment #51
pimentoski CreditAttribution: pimentoski commentedAbout the special characters i lost some of my time study php (i am a ASP, VB developer) and i discover this:
on the fast_gallery.class.php if you change the line 246 to
the special characters disappear but the rest of the word stays ok.
for example a Portuguese word like "rígido" became "rgido" in your version "rígido" became "r"
but the good news is, if you add this in the line 246
the string appear ok!!!!!!
EDITED: just put the line 246 like this and it will work fine (i guess)
Comment #52
ncy CreditAttribution: ncy commentedthanx for researching the special chars problem, pimentoski :)
Comment #53
rapsli CreditAttribution: rapsli commentedcommitted to head
Comment #54
Anonymous (not verified) CreditAttribution: Anonymous commentedAutomatically closed -- issue fixed for two weeks with no activity.