By lurkltd on
On the site I am working on, the client wants to have a pool of photos that they can pull from and use anywhere on the site. We have uploaded all of these images using the image module. Now, we need to be able to pull up to 6 specific images as a mini gallery into the bottom of certain pages. Normally I would just use cck and image field type, but the client wants to have a pool of photos that they can pull from and easily attach to different nodes.
Any idea of how to get this done?
Comments
tried imce?
have you tried imce (http://drupal.org/project/imce)? you don't have to use it in conjunction with tinymce (although i do recommend it with bueditor) so it can be attached as a stand alone item on a cck field. with imce, you allow users to keep libraries of images that can be selected from a visual browser.
Mark Sanders
Q Collective
Mark Sanders
Q Collective
cool thanks. that looks
cool thanks. that looks promising.
I'd like to use something that involves image content types though. I'm going to need to pull them into the page and manipulate them with css and javascript, like in slideshows and stuff not just have them be in the text. I realize this may be impossible though. Maybe with the node reference field?
thoughts...
I'd normally use image_attach for cases where I want to address and theme attached images - however that doesn't (yet) support multiples (old patch issue).
You are probably on the right track with nodereference however! You'll need some custom work on the UI to make it friendly (thumbnail selector?) but good luck.
.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/
.dan. is the New Zealand Drupal Developer working on Government Web Standards
Yeah this looks like it's
Yeah this looks like it's going to work. I'm going to have to get some help with the php, but I think it'll be the easiest for us and for the end user.
Hooray I did it! I used node
Hooray I did it!
I used node reference in a field called page images & I used this php in my node-page.tpl.php file. This doesn't seem like a good idea. is there a better place to put this code? Does it need to be put into a module?
template.php
seems like you should create a function in your theme's template.php file. try the following:
in your node-page.tpl.php place the following wherever you would like to display the image(s):
hopefully that works for you.
Mark Sanders
Q Collective
Mark Sanders
Q Collective
Awesome! it worked. I think
Awesome! it worked.
I think eventually I'd like to flesh this out into a module since it seems like something that a lot of people want to be able to do, but this will work for now.
a new cck field
To be really co-operative, this would be easily added as a CCK widget of its own
- nodereference-image field
And combine the best of CCK nodereference and image-attach functionality. You can probably even re-use the nodereference table.
This would be easy to distribute, and small to code, although it's a bit of an adventure the first time you try to make a custom CCK field (the SQL magic is odd, just copy & paste). There are some OK docs available however, took me an hour or two to get my first one running.
.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/
.dan. is the New Zealand Drupal Developer working on Government Web Standards
close but not quite probably
i've used node_images (http://drupal.org/project/node_images) to construct javascript image galleries on a couple of sites. i really like the interface (it's quite intuitive once you embrace the concept) and it allows you a lot of flexibility in how you use the images.
the one thing it doesn't do is allow you to pick from a pool of images. each image has to be individually uploaded once the node is created. the module allows an unlimited number of images be directly associated with a node which is much cleaner than any taxonomy approach i tried.
Mark Sanders
Q Collective
Mark Sanders
Q Collective
You can create a View that
You can create a View that pulls up the images you want, and then access that either with a CCK viewfield or directly in the node template.
hmm.. tried this, but it
hmm.. tried this, but it seems like I'll have to create a view for each node? Or is there some way to dynamically generate a view using the taxonomy of each node that I'm missing?
You can use one view and use
You can use one view and use a view argument to filter.
I actually did this on an old site, which has since died -- turns out I still have the code.
I had nodes of type 'project' and on these I wanted a view to show related nodes of type 'news'.
This is from the node-project.tpl file:
well yes, but...
I see what you are saying, and how that could be made to work, but the interface may be a bit confusing.
You'd need to group the pictures (a bit like gallery) then link the node to the group. Taxonomy can be leveraged like that, but it would be more suited to re-using a small set of groups with a large set of nodes. In some cases that would be quite useful!
However, if the editor wanted to make their node, then (from the node edit screen or nearby) choose a handful of the images individually each time, that approach would be a bit hairy.
Whilst from an info-management POV using groups makes sense to me, in practice I find explaining that concept a bit hard to users who just want to link directly to their targets. It's a bit like educating folk to define styles (in CSS or MSWord) then re-using the styles rather than making text big and bold.
While it's more clever to do so, it's not always natural, and not always worth the effort just to get the result :-)
With a very clever UI widget (like one that auto-creates a taxonomy term for each new node) your approach could be useful, but I dunno if it's really the right thing. If you were going to that trouble, you might as well avoid taxonomy and views and just make a special-purpose module to do the job well.
... and it would end up looking very much like the nodereference table.
I reckon.
.dan.
How to troubleshoot Drupal | http://www.coders.co.nz/
.dan. is the New Zealand Drupal Developer working on Government Web Standards
Yeah, I know what you
Yeah, I know what you mean...
For the site I made this for, we had less than half a dozen projects, and news stories, pictures, etc, would be tagged as relating to one or more of them. So I think it worked fairly well for that.
But for attaching a choice of images to a node, especially if the number of nodes is large... it's sort of the wrong way round. You want to be able to create the node, and pick some images from a list.
Like you say further up, the patch to allow multiple attached images is ancient, and probably need redoing from scratch. It's a real shame that drupal doesn't have any image support in core, I think.
yeah that's exactly what
yeah that's exactly what we're trying to do: attaching a choice of images to a node from a large number of nodes. Hopefully the nodereference thing will work!