4

Working on a new Drupal 7 based site. Put together a few sites back in the 5 days, but lots has changed.

I'm looking to allow users to upload images to a particular content type, and to show those images as a gallery. Restated - I'd like user X to be able to create a node, and then users X, Y, Z, P, D, and Q to each be able to upload images to that node. (Looking to the future, I want people to vote on images, but let's keep it simple, for the moment.)

My sense at this point is that I have to create an entity type for image, use entity reference to point from the images to their parent node, and use views and probably eva to show the galleries on the parent node.

Question 1: Am on the right track here?

Question 2: How should I handle the 'allow anyone to upload images' piece? I'd like there to be a rather simple opportunity, when a user is viewing a parent node, to upload an image or provide an image url, and for the image node to be created and appropriately associated.

Thanks for any help.

3 Answers 3

0

You could just use the modules: http://drupal.org/project/references and http://drupal.org/project/nodereference_url

This would work if users create new images as nodes. With the help of the second module you achieve that the relation between image node and parent node is automatically created and it also allows to set a link directly on the parent node (a la: create image for this content).

I don't think that you would need EVA in this case. The view to show all images per parent content is straightforward with one argument based on the relation.

What I describe above is pretty much the way you would have done it in Drupal 6 as well. You might get additional features (and maybe complexity) using the module entity reference and EVA.

Hth.

0

Another solution would be to have users create a node for each image and then select the "gallery" the photo is assigned to. You can use the built-in taxonomy term reference for that.

To automatically prefill a term reference field (to upload a photo for a given gallery) you can use the prepopulate module.

0

To answer your questions,

 

Question 1: Am on the right track here?

Yes!


Question 2: How should I handle the 'allow anyone to upload images' piece? I'd like there to be a rather simple opportunity, when a user is viewing a parent node,

When displaying the gallery, display the form for users to add a new image.


to upload an image or provide an image url,

You can add 2 fields,

  • Field image (image field)
  • Field image url (link?)

You will need to add logic, determine precedence.

Another option, add a third field that allows someone to check if it's an image or a file and then based on that, present the right field.

For your display,

If it's an image url, you'll need to decide if you'll either download the image or just use the URL provided. (You mentioned in the future voting, so people could down vote problematic/broken links.)


and for the image node to be created and appropriately associated.

https://www.drupal.org/project/entityreference_prepopulate

:)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.