Description
Inplace Gallery is a Drupal 7 module, which implements a field formatter for image fields to display multiple images in a nice and configurable gallery, which can be further themed with CSS styling.
At present there are four different available styles, which can be further personalized through the admin interface and CSS styling. These include:
- Thumbnails: fixed width and adjusting thumbnails dependent on number of thumbnails and width of the gallery
- Numbered: numbers instead of thumbnails
- Buttons: buttons instead of thumbnails, which can be replaced by own images.
The module comes with a calculator which shows possible combinations of thumbnail number, thumbnail width and gaps for a given width of the gallery.
The galleries can be operated with either mouse clicks, arrow keys or swiping on a touch device.
Demo galleries can be found at http://inplacegallery.okast.ch
Similar Projects
The only drupal 7 gallery I found which also acts as formatter is http://drupal.org/project/galleryformatter
While this is also a nice tool, we wanted to create one solution for most of our projects, with the ability to either have thumbnails or a different navigation possibility. Further we wanted to have built-in touch support and the possibility for admins to easily create a gallery without needing to know about CSS.
Licensing
Inplace Gallery uses the jCarousel and touchSwipe JS Libraries, both are dual licensed under MIT and GPL.
Sandbox Project Page
http://drupal.org/sandbox/flosuter/1277538
Git Repository
git clone --branch master http://git.drupal.org/sandbox/flosuter/1277538.git inplace_gallery
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | inplace_gallery.tar.gz | 239.18 KB | flosuter |
| #4 | inplace_gallery.tar.gz | 219.28 KB | flosuter |
| #2 | inplace_gallery.tar_.gz | 209.87 KB | flosuter |
| Screenshot Distribution possibilities | 52.01 KB | flosuter | |
| Screenshot Gallery with Buttons | 260.93 KB | flosuter |
Comments
Comment #1
patrickd commentedPlease do not push into the master branch, follow the instructions on naming conventions here:
http://drupal.org/node/1015226, git branching: http://drupal.org/node/1066342
Your code looks good. Coder gives me just one issue:
What I really don't like is the way you are processing the CSS in line 400 to 508.
I never did something like this but I'm shure there are better ways like: reading a css with placeholders; replacing the placeholders with the nid; adding it inline
regards
Comment #2
flosuter commentedThanks for the review.
I removed that trailing space and pushed the project to a new branch 7.x-1.x, should the master branch be empty?
Concerning the CSS: I did it this way, since every gallery preset needs its own set of CSS rules and drupal_add_css states that it's better practice to add files so these can be aggregated and cached. So we could have a preset css file with placeholders which is then loaded with file_get_contents() and then just use str_replace() to fill in the placeholders and then save the file along with the images.
I committed the changes to the sandbox or see the attached tarball.
Comment #3
klausiYes, it is more clear if the master branch is empty. You can leave a README.txt there like this one http://drupalcode.org/project/rules.git/blob/refs/heads/master:/README.txt
Comment #4
flosuter commentedThanks for the review, I committed the changes to the sandbox.
Comment #5
klausiComment #6
flosuter commentedI can't attach the .tar.gz file, but all the changes have been commited to the sandbox.
Comment #7
flosuter commentedWell, I CAN attach the file, didn't work before, but nvm.
Comment #8
klausiNo need to upload your module here in the queue, pushing to the git repository is enough.
I think this RTBC. Now while we are waiting for the access grants to create full projects would you be so kind to do a review of the other applications pending? Just pick one from this list: http://drupal.org/project/issues/projectapplications?status=8
Comment #9
gregglesPlease take a moment to make your project page follow tips for a great project page.
The image title display is vulnerable to cross site scripting. To see this vulnerable enable the alt and title fields. Enter
<script>alert('title');</script>as the title for an image and then save the node.There is a text filtering cheat sheet which might be helpful. In this specific case I suggest using the l() function which provides automatic text sanitizing for the arguments in addition to building links.
The handbook on writing secure code has more information on how to write secure code in Drupal. Please read that page and all subpages of it.
Comment #10
flosuter commentedThanks for pointing that out. I fixed the issues and extended the project page.
Not sure if this needs to go back to "needs review", just change it if I was wrong.
Comment #11
klausidon't RTBC your own issues, needs review first.
Comment #12
klausiReview of the 7.x-1.x branch:
This automated report was generated with PAReview.sh, your friendly project application review script. Please report any bugs to klausi.
manual review:
Comment #13
flosuter commentedcorrected all the issues from #12
tried running PAReview.sh myself but somehow couldn't, looks like a very nice script for developing.
Comment #14
pflame commented1. Line 128: in most cases, replace the string function with the drupal_ equivalent string functions
2. In the inplace_gallery.module file, the function inplace_gallery_field_formatter_view function, for the controls html can be placed in a theme function, so that the function will be more readable.
3. In the inplace_gallery.module file, at line number 300, you added inline js to enable inplace_carousel, you can pass the entity ids to js and write the initialization code in the javascript file inplace_gallery_load.js.
4. In the inplace_gallery_load.js, using global variables activeThumbs, jcarousels is not a good idea. These global variables might get conflicts with external js includes. Eighter you prefix these variables with your module name or create a simple construction function to store these values and generate objects.
Comment #15
JacobSingh commentedFor point #3, look up Javascript Behaviors in Drupal. Using this API, your initialization code will run after the document is ready automatically. If you need to pass additional settings, use ['#attached']['js']['settings'] on any renderable element, or you can use drupal_add_js('settings', $array_of_settings). These will be available as Drupal.settings and passed to your behavior when it is launched.
http://drupal.org/node/756722 is a good resource.
Comment #16
frauprofestl commentedHi, I was so pleased to come across this module as a simple gallery with numbers rather than thumbnails is exactly what I'm after. However, after spending a whole day on it, I had to give it up, as I couldn't get the gallery to load the images. It just displays the alt information. When I click on the view image info, it tells me that there is no image where the path points to. I fiddled with image size, type, changed permissions etc. but no success. I would love to get this up and running, so if there is a simple solution, I'd be very grateful for a reply.
Comment #17
misc commented@flosuter has been contacted to ask if the application is abandoned.
http://drupal.org/node/894256
Comment #18
flosuter commentedI'm back to working on this module. Should be fixed over the course of the next week.
Comment #19
flosuter commentedFinally got around updating the module.
First the answers to your questions:
In the documentation to drupal_substr() it says:
So I figured I'd just use the normal function.
Moved the controls to a new theme function.
Also rewrote this part as suggested in #15
Renamed activeThumbs to inplace_activeThumbs and removed jcarousels since it wasn't needed anymore.
Additionally I rewrote some of the file handling so it isn't completely dependent on drupal_realpath(), since this would not work with a remote filestorage.
Unfortunately I couldn't test this. So any inputs are very welcome.
Comment #20
donatasp commentedAutomated review
http://ventral.org/pareview/httpgitdrupalorgsandboxflosuter1277538git
Manual review
, but in inplace_gallery.module:inplace_gallery_field_formatter_view() these strings are used untranslated.
Over-commentingThere are undeclared variables in
forloops in inplace_gallery.admin.js.directionandinplace_activeThumbsin inplace_gallery_load.js. In JavaScript they will be created in global scope and this might lead to strange bugs. You should declare every variable withvarto prevent name collision in global scope.I have to admit, I didn't look very closely, but code looks and "feels" good.
IMO such overly thorough commenting style is is a bit too much:
I've moved this point out of review, because this is really just my opinion and not something suggested in Drupal code standards.
Comment #21
donatasp commentedForgot to change status to "needs work".
Comment #22
misc commented@donatasp: Too much commenting could never be an issue in my book, it is not bad to explain code, even if it could be obvious for many.
Comment #23
donatasp commented@MiSc: I agree. This is a topic for a debate (without an end) and I shouldn't have put that in a review part of my post.
Comment #24
flosuter commentedI'm taking this off the application queue, but will leave the sandbox and maybe submit it later when I actually have time to make all the changes.
As far as I'm aware it works fine, since we're using it in multiple projects. But issues with it can still be reported through the sandbox issue queue.