Hello everybody,

could any good soul enlight me on how to let final users attach *easily* more images to a node, and then output (show) them nicely as thumbnails in a block on the final node page?

I have considered almost all the possible Drupal solutions for handling images, but each one seems the piece of a big scattered puzzle...it let's you do one thing, but not the others...

This is what i considered:

[1] upload (or upload_image) + nodeimageblock
PROS:
+ possibility to attach more images to a node
+ possibility to show these images on the final node page
CONS:
- lacks thumbnail/preview images generation
- lacks any sort of theming of the output (it just throws images as they are one stitched roughly to another in a block)

[2] image + attach_image + CCK (or Flexinode)
PROS:
+ friendly User Interface
CONS:
- Possibility to attach only 1 image

[3] image + img_assist + CCK (or Flexinode)
CONS:
- way too complicated workflow for final users

[4] cck + imagefield
PROS:
+ possibility to attach more images to a node
CONS:
- the number of images available has to be set in advance in the content type
- does not generate thumbnails / previews

[5] image_tab
PROS:
+ possibility to attach more images to a node
CONS:
- not yet ready for 4.7
- uses a Tab to add images (not ideal, since Tabs are not that visible)


Any hint or advice about what i am looking to achieve is really apreciated!

cheers

Comments

jon pugh’s picture

This is my favorite gripe about drupal, and just about every site i've built using it (at least a dozen) needed image handling.

for one site, i built a custom module that uses only the upload module. When files are uploaded are images, it creates thumbnails, adds them as additional attachments (like image.module). however, it will do it for every attached image.

This method skips adding images as nodes, and is therefor meant for sites that don't need that added functionality.

This worked on the original site is was written for, but i haven't successfully ported it to another site.

i'll reply here when i've got something working.

__________________________
Jon Pugh
ThinkDrop Inc
https://devshop.support
https://thinkdrop.net
https://twitter.com/jonpugh

marcoBauli’s picture

thanks for considering this thepugh, i will do the same when i'll find a solution.

cheers

sangamreddi’s picture

Could you post the code here?

Sunny                      
www.gleez.com | www.sandeepone.com

willdashwood’s picture

It seems every Drupal site I come to do struggles at the stage of sorting out images. Does anyone know what the future plans are for Drupal and image functionality? Surely it's time to consolidate all the fragmented projects out there and come up with one or two modules which are flexible enough to do everything we need, customisable via a settings page.

It's this kind of thing which is hurting Drupal but I'd be willing to contribute as best I can if we can get these image problems sorted once and for all. image_attach.module would do the job for me if only I could attach more than one image per node.

high1memo’s picture

The method I use for this is using the categories module + CCK + image module - might not be the cleanest, but I'm happy with it.

PROS:

  • possibility to attach unlimited images to a node
  • automatically show these images on the node page (i usually theme node-content-foo.tpl.php and node-image.tpl.php to make it look nice)
  • automatically generate thumbnails / previews (the images are created via image module)
  • If you are viewing an image, in the taxonomy section it shows which node(s) it belongs to, clicking on the taxonomy will take it to the node details (with all other thumbnails) - so basically you have a link back to the node from the image,

CONS

  • I mention this after the step by step.

Below is a step by step how to create a nodetype called Artist which can have many images assigned to it.

Setting up:

  1. Create a custom CCK or flexinode node type (e.g. Artist - fields: name, dob, brief bio, etc. . all fields excluding anything to do with images) - you may have already done this.
  2. Create a container called Artist Photos which accepts nodetype Image
  3. In admin / settings / category under the Content type settings section enable other content types to be Categories
  4. In admin / settings / content types I click on the configure link next to my Artist node type
    1. Under the Category behavior: section tick Category
    2. Under the Category - allowed containers: select the containers Artist Photos

So now whenever we create a node of type Artist it will also act as a taxonomy term under the container Artist Photos.

So then we just create images as we normally would using the image module, and from the Categories section we select whichever Artist we want it to belong to and voila!

Only problem is: If you already have created a bunch of 'Artists' which you want to assign images to, those existing ones will not already be categories for images. The steps above only enable new Artists to be categories, so for each existing Artist you need to edit it, and without doing anything, just click Submit. That will force the category module to create a category from that Artist. If you have already created hundreds of Artists then you might wanna think of a way of automating this!!

 

 

mr john’s picture

I think this may work for me but I also need many-to-many relationships. For example, is there a way to have an art piece belong to more than one artist (like a collaberation)?

Zoologico’s picture

How would you do this with 5.0?

rivena’s picture

I don't know if this helps you, but I used the image.module, upload.module, and image_attach (came with the image module in contrib). This displays all the uploaded images in a list after the node. I don't quite like how it displays (not side by side), but it's easy to do.

Anisa.

-----------------------------------------------------------
Kindness builds stronger bonds than necessity.

www.animecards.org - 18,000 card scans and counting!
-----------------------------------------------------------

jax’s picture

You might want to have a look at this: http://drupal.org/node/87991, it implements what you ask for. If you have suggestions please add them to the feature request.

isaac77’s picture

this lullabot article is useful, though it might not take into account new tools that are still in development...

http://www.lullabot.com/articles/image_and_image_exact_sizes_vs_imagefie...

MrTaco’s picture

you can do that with my cck subform module

create a new "image_holder" content type that contains an image field

then create a relation between your parent node type and this image_holder type

then create a subform field in your parent type, and tell it to operate on the relation you just established

http://subform.googlecode.com/svn/trunk/subform_trunk.zip

coupet’s picture

Subform is a CCK field type
http://drupal.org/project/subform

----
Darly

stefano73’s picture

You can try the Node Images module.

coupet’s picture

Adds an Images tab to the node page, allowing users to add images to the node using the upload.module.

----
Darly

Zoologico’s picture

[4] cck + imagefield
PROS:
+ possibility to attach more images to a node
CONS:
- the number of images available has to be set in advance in the content type
- does not generate thumbnails / previews

How do you set the number of image. I find that I can only set whether or not Multiple Images are allowed, not how many.

Thanks.

shyamarjarapu’s picture

Actually, I was trying to get node content in this fashion

some text here

image 1

some text here

image 2

some more text here

well CCK + imagefield with multiple images help me to add more images however, it doesn't let me spread the content + images. I am currently using image,upload,tinymce,imce to help me solve this. As you can see we are lacking thumbnail preview here in teaser. I am going to adjust myself without any images in the preview

sprintstar’s picture

Agreed, image handling is poor. I have used Image and Image Assist modules, but there are currently so many problems with them on Drupal 5 that they are currently unusable. I think Drupal should support images embedded (either origional or thumbnail) in nodes as core functionality, or at a least a module that is commonly used and reliable!

borstahusen’s picture

I agree. I too used img_assist but with Drupal 5.1 existing images don't show anymore.

rimian’s picture

Why not extend your content type to include an image gallery. Create your image gallery (with your multiple images) then with an auto complete form field associate that gallery with your node. So you'd have a table in your database with the node Id and the term ID of your gallery.

http://www.rimian.com.au
http://www.freelancewebdeveloper.net.au

Bobuido’s picture

Is there anything new on this front / topic?
image_gallery doesn't seem to present galleries as nodes so would node reference cck fields actually work?

To be honest I'm shocked that the functionality isn't in the image module. My server admin has already mentioned memory becoming an issue. He's not going to like me adding yet another module to what is already a beefy project

BTW I thought you meant image_gallery at first - In case anyone else was confused I presume you were recommending this module
http://drupal.org/project/gallery

Will check it out now - Thanks

Current (Main) Project: http://www.wii-view.co.uk

rayray’s picture

I too am surprised there's no one good way to handle this fairly basic feature in Drupal.

Bobuido’s picture

Create an image gallery using only CCK and Views
http://drupal.org/node/144725

I settled for a Views powered gallery in the end. Really simple to set up. Especially with the above guide

Hope that helps

Current (Main) Project: http://www.wii-view.co.uk

kirilius’s picture

That's not what the initial poster was asking for. The "CCK and Views" solution works well if the site administrator is setting up the galleries. However if the requirement is to let the user create their own galleries, then we are back to the original question: what is an easy way of users to attach multiple images to a node.

Even if one opts to use the "CCK and Views", then the question would be: how to let the users create such galleries themselves? And since users create nodes, how to attach a gallery to a node?

Blueeeeie’s picture

Searched for ages for a solution to the 'attaching multiple images to a node' problem. Its not the attaching of multiple images to the node thats the difficult part, its the displaying in nicely and correctly on the page itself thats tough.

In the end, the cleanest and easiest solution I came up with was to use custom php code to print out the images on my page. I'm not sure if this would be considered an ideal solution to the poster, but I thought maybe I could share it.

The modules I used were the CCK + Contemplate + Imagefield + Imagecache

- Configure a preset for your node images on Imagecache.
- Go to your content type and add a new Imagefield for your content. Enable the 'Multiple values' checkbox to allow for more than 1 image to be uploaded.
- Under Display fields, select the preset you had created earlier in Imagecache as a display option for your new image field.
- Using contemplate, you can add the following code to print out the images:

foreach($node->nameofyourimagefield as $img)	{
 print $img['view'];
}

And it'll print out all the images that have been attached to your node.

You can see an example of how my page looks at http://www.drupaldiy.com/showcase/shopabble
I had customized the code above to print my images out in a grid format.

Hope this helps!

xalexas’s picture

Well I don't really like how Drupal handle images. I think it could be way better. But Drupal have tremendous scalability, so something must be sacrificed.

The best what I came with images in Drupal is CCK+Imagefield+Imagecache. That way you have dynamic thumbnail resizing and with Insert module you could have inline images! Take care with Insert module, it just inserts hardcoded absolute path so if you change domain you'll have to rewrite all images url's.