Which image handling modules to use?

Emma - August 17, 2009 - 11:10

Hi,

We are currently working on a site that has a series of lessons on it. We would like our students to be able to upload one or two photos per lesson and have these displayed in a gallery linked to that lesson (but on a separate page) so that tutors and other students can comment on them.

We would also like to be able to display a gallery, per student, bringing together all their photos they have uploaded for the lessons. (So that we can see their individual progress and so that they have a page they can show their friends).

I have been looking into this for several days now and the more I look the more confused I am getting as there seem to be multiple ways of doing similar but not quite the same thing. It also doesn't help that I'm having problems using ImageCache and most of the tutorials I have read/watched seem to use this...)

So, any suggestions as to the best way of doing this would be gratefully received! (With easy step by step instructions appreciated as I've only just started to work with drupal a few months ago, although I think I'm getting the hang of it now!)

Many thanks,
Emma

Update

Emma - August 17, 2009 - 13:43

Have now fixed the problems with ImageCache (tracked it down to a missing .htaccess file which was preventing me from using cleanurls).

So, I can now:

upload images
& view them in a simple gallery

Now - the question is how to add a form to the bottom of each lesson (or a page linked from the bottom of each lesson) so that students can easily upload their photos and so that they are put in the correct gallery?

Yes, there are umpteen ways

adam_b - August 17, 2009 - 16:03

Yes, there are umpteen ways to manage images within Drupal... come the revolution, it'll all be clear.

What are lessons in your system? Are they a node type?
Should the uploaded images be primarily accessed by lesson? or by the student who contributed them?

Views should be able to handle this (like almost everything else).

When is the revolution??

Emma - August 17, 2009 - 17:11

The lessons are a node type that I have created using CCK

They are organized into modules using a book hierarchy so I did wonder about having the upload page and/or gallery as a child page under each lesson, but not sure if this is the way to go.

I did think about having one actual gallery (created with views) but somehow tagging the images according to which lesson they were added from and then showing a filtered gallery based on this for each lesson. Could I do this with Taxonomy somehow? I can see how this could be done with one upload page - but would rely on the students choosing the right lesson to link their photos to. To have the lesson automatically selected would be good...

The primary access should be by lesson - but it would also be useful to view by the student who contributed them (using something like Author Pane/Advanced Profile Kit???)

Thanks!

Well, part of the revolution

adam_b - August 18, 2009 - 15:25

Well, part of the revolution might happen in D7, which is supposed to include a standard image API. In the meantime, I'd say you were moving in the right direction with your gallery idea. There are a lot of alternative methods, but off the top of my head, I'd suggest:

1. Create an image-node type
- use http://drupal.org/project/imagefield or http://drupal.org/project/image; I personally prefer the former
- add whatever fields you want for metadata, and give students access to create this node-type
- add a CCK node-reference field so that they can choose the appropriate lesson
- you could also use taxonomies here - eg tags like Flickr, or formal categories

2. Make a view of image nodes:
- add fields to show the relevant title, image thumbnail, etc
- add Filter by Node-reference and expose it - users can then choose the relevant lesson
- add Filter by User and expose it - users can then choose to view by the image-node creator
- play around with the display to obtain sexy gallery-type effects
- add filters by taxonomy to drill down in the content

That's a fairly basic setup - you could use arguments to transmit the lesson's node ID to the image node and automatically select the appropriate lesson... but I'm out of time now and this is probably enough to start with.

Thank you!

Emma - August 20, 2009 - 09:02

1. I had already created the image-node as you suggested but I had set up a taxonomy list for selecting the lessons and was wondering how I could automatically update this when new lessons were added. Node-reference makes it much easier now!

2. Thanks, have now set up a view following these instructions and its working well and looking good. (Am looking at adding thickbox/lightbox to improve looks but not critical as it WORKS)

At the moment now I have students able to add photos only from the navigation menu. You mention using arguments to send the lesson node ID to the image node. How would I set this up? Would this allow me to setup a link from each lesson saying eg "upload your photos here" and have then submitted to the correct lesson? This would be fantastic :)

Okay, after blithely giving

adam_b - August 24, 2009 - 09:39

Okay, after blithely giving you advice I then had to figure out how to make it work. Here's where I've got to:

1. Create a variant of your view without exposed lesson filter, which takes the argument "Content: lesson" (ie the "lesson" nodereference field from your image-node type).

2. Create a new view filtering on lesson-node type, which takes the argument "Node: Nid"

3. In your image-node type, change the nodereference field so that it uses the view you created in (2), and enter the argument in the field. Unfortunately this field won't take a token at present - see http://drupal.org/node/196518 for discussion - so I put in a relevant lesson-node ID for test purposes.

4. Download and install the http://drupal.org/project/token and http://drupal.org/project/custom_links modules. The former doesn't need any configuration. The latter is a nice module but unfortunately lacking in documentation. Eventually I figured out that you need to create:
- one custom link to http://domain/view/[nid] where "view" is the path for the view created in (1), with the token "[nid]" at the end to provide the argument
- one custom link to http://domain/node/add/image/[nid] - ie the path used to create a new image-type node, with the same token "[nid]" at the end to provide the argument

So, what you should wind up with is:
- A link from your lesson-type node to a view showing the images for that lesson
- A link from your lesson-type node to a form to create an image-type node, where the list of lessons in the nodereference field doesn't quite work yet :(

That's as far as I can go I'm afraid - I suspect someone who knows PHP could write the link manually, but that's beyond me. Good luck.

ETA: I thought afterwards that you could of course just edit the lesson after you've saved it to add the NID to a link manually, rather than using the custom_links module - not that big a deal, but I was trying to work out how to automate it.

Thanks again!

Emma - August 28, 2009 - 10:09

I have been manually editing the lessons after creation to add the link from lesson to gallery in. Its working OK at the moment as I'm doing a lot of work on the site anyway but an automatic way for the future would be great as I'm hoping to step back a bit once up and running.

I also found that I didn't need a separate view but could use the view with the exposed filters.

I realized this as when I was playing with the created view and using the exposed filters it changed the address from mysite.com/photo to mysite.com/photo?field_photo_lesson_nid=27 so by creating an internal link to
mysite.com/photo?field_photo_lesson_nid=27 it all worked. :) This has the advantage of only one view and that once they are viewing a lesson gallery they can still change to browse other lessons and by user as well.

Custom links looks good - there is now a tutorial at http://drupal.org/node/561562 with examples at http://drupal.org/node/561604 so I may try that one in a bit to help automate it.

I'm also looking at custom pager to add back-forward links to the photo pages - not sure how this will work when photos are categorized by lesson and user but will give it a go.

Thanks again!
Emma

Simple image upload to Galleries

CasaDelGato - August 17, 2009 - 16:15

I'm currently using BrilliantGallery as my site Gallery handler. ( http://www.ACEF.org/ see the "Gallery" menu item)
Since it just uses a simple directory in the Files area for each Gallery, I'd like to provide a way for people to upload files to one of these Galleries. (Controlled by permissions/roles of course)
All the file upload modules I've seen seem to want to create nodes for the files.
I just want to put the file into a directory. No database changes whatsoever.

(I'd also like a way to have some people only allowed to upload to a temp directory, and then have one of the admins verify it and move it to the Gallery.)

Drupal doesn't know of the

adam_b - August 18, 2009 - 14:36

Drupal doesn't know of the existence of files unless they're referred to in nodes, so I don't know of a way to do what you want.

Also, this really isn't related to the original topic. You should start it as a new topic - you might get more response that way.

 
 

Drupal is a registered trademark of Dries Buytaert.