Node Reference CCK field does not show thumbnails???
Here is what I need:
- I need to create a custom node type that will allow the users to attach already uploaded images (Image nodes) to it.
Here is what I do:
1) I create a custom node type with CCK and add a field of type "Node Reference"
2) Node Reference has an option called "Content types that can be referenced" which I specify either by checking the appropriate node type or use a view instead. I choose to use a view because I want the user to see thumbnails instead of bare image names.
3) I create a view to display user's own images only:
- I select "Bonus: Grid View" for the view type
- I check both "Provide Page View" and "Provide Block"
- I add one field to the view: "Image: Display Image" and set it to "thumbnail"
- I add two filters to show only current user's pictures
The view works fine when called from the view-page URL: I see the current user's pictures as thumbnails ;-)))
Then I go on creating my custom node type...
4) I choose the newly created view to restrict the images that can be referenced by the custom field.
5) I save the new content type and try to create a new node of that type. The result is that the custom Node Reference field that I just added is displayed as only a list of bare image names ;-(((
- Does this means that the Node Reference field does not respect the view definition that is given to it?
- Does this mean that it cares only about the view's filters?
If the answer to those questions is yes, then can you suggest how can I give the users any sensible way to attach images to a node? I want my users to see thumbnails instead of 3-line-list of image names. After all these are images ;-)

Anyone?
Anyone?
inlining images
Unfortunately, I haven't had any responses to a similar question at http://drupal.org/node/136262. It would be great if the nodereference contents could be inlined into the view (my case) or node (your case). This would also alleviate the constraint in the image module which allows only one image to be attached.
Related Nodes just returns "nid"
I'm referencing a view -that shows related audios- in order to reference some of them in an article. The thing is: In my local site the view returns the title of the node and the url -which is perfect, in my article view I can show a list of this 'related audios'-. Digging with print_r($node) i see:
[field_related_audios] => Array
(
[0] => Array
(
[nid] => 1673
[view] => This is a test audio
)
[1] => Array
(
[nid] => 1676
[view] => another test audio title
)
)
In my remote site, though, the view returns just the nid -or at least is what I can see in the node array on the article:
[field_related_audios] => Array
(
[0] => Array
(
[nid] => 659
)
[1] => Array
(
[nid] => 510
)
[2] => Array
(
[nid] => 511
)
)
The views are both List View, and I'm putting the Title [as a link] field.. I even try to put a "Teaser View" just to see if this field values changes but it's the same.. just the nid
any ideas?
thanks!
resolved
I just deleted and re-created the node reference fields -and everything was good-
Can you tell me a bit more
Can you tell me a bit more about what you did to get the nodereference values to show up in a view? I've tried deleting and re-creating the fields but I'm still getting the nid's instead of the array values. I've been trying to figure this out for a week. About 30 or more hours. I'm freaking out a bit.
Thanks in advance!
Success with Auto Complete
I've found a solution that's not perfect but might be a bit better.
If I configure my Node Reference Field to be an "Autocomplete Text Field" instead of a "Select List", then I see the thumbnails from my view in a drop down list.
This is not great because your users will need to know what they're looking for before they look for it (not ideal). A workaround for this is to add in the help text for this field: "Select the field and hit the spacebar to see a complete list of nodes".
I realize it's not the best solution but that's all I could come up with at the moment.
cck's imagefield
Am off to investigate the imagefield (vs image nodes)
Up!
Up!
try the /image/view/nid shortcut
i'm not sure i understood your question, but if i did you can use the /image/view/123 where 123 stands for any image-node nid (or was it /view/image/123) shortcut to show the image for a referenced image node. it's heavy on resources since it node_loads every referenced node, but it's the only way i know how to do this (other then playing cardcore with other people's code)
To clarify what I am trying
To clarify what I am trying to do:
I have a base content type, let's call it "place" with a few text fields describing it. I also need to be able to attach multiple images (image nodes!) or other nodes to it. Imagine a "place" and a bunch of pictures that describe it.
A typical work flow from a user's point of view is:
1) Open my website
2) Clink on a link to start creating "places"
3) Fill in the text information
4) Add images (or other nodes) to the main "place"
The problem is that this "adding" of a dependent node is not very straightforward and since these are images, I want the users to see thumbnails (why not with checkboxes). I would also like the users to be able to upload images at that time, which will be attached to the main node.
To show thumbnails
To show thumbnails foe the images simply point the CCK nodereference field to a view you themed so it would show a thumbnail. To allow upload you will have to write a lot of code (this is what we are doing at the moment, but i cannot distribute it.
That's what I am writing in
That's what I am writing in the initial post - I have the view and it shows the grid of thumbnails correctly when called directly (with its URL). However when I try to use the same view in the node reference field, it is ignored - no thumbnails are displayed. I see only a list of image names.
got it
try to import this view and start from there (remote the php tag before import).
Note that the view only defines the fields that return. I am not sure how to theme them, maybe the theme wisard can help. Also note that it does not provide any page/block.
<?php$view = new stdClass();
$view->name = 'images_w_thumbs';
$view->description = 'used for cck noderef field';
$view->access = array (
);
$view->view_args_php = '';
$view->sort = array (
);
$view->argument = array (
);
$view->field = array (
array (
'tablename' => 'image',
'field' => 'nid',
'label' => '',
'handler' => 'image_views_handler_image_img',
'options' => 'thumbnail',
),
array (
'tablename' => 'node',
'field' => 'title',
'label' => '',
'handler' => 'views_handler_field_nodelink',
'options' => 'link',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => 'image',
),
),
);
$view->exposed_filter = array (
);
$view->requires = array(image, node);
$views[$view->name] = $view;
?>
Thanks, I'll try it.
Thanks, I'll try it.
node reference advanced configuration
as far as i understood, node reference can use a view to select which node can be referenced which is very different from use a view to display the nod being referenced.
erratum
in fact i misread what you wrote
even taking the view given above, indeed the create/edit form does not display images but just a list of node titles contrary to what the help text says :(
how woul you handle it ?
also, how would you handle the selection of multiple references if image thumbnails are supposed to be displayed ?
this is somewhat tricky! :)
I'd be very interested in
I'd be very interested in what you manage to figure out, but as far as I know this isn't something Drupal can do.
Image.module can attach a single image node to another node, but that's quite a limitation.
Do you want a pre-defined list of images for that node, or actually being able to pick images as you go?
If that's the case, use a Viewfield CCK field rather than a Node Reference. However (again...) you might end up needing a new fiew for every user, as I don't know how advanced the passing of view arguments from the Viewfield to the View is. I've seen threads and issues suggesting there's development afoot here, if you can wait.
Another option for this is to create one view with a user argument, and embed it into that content type with node theming. You can then pass the argument from the current node to the view.
not quite
i guess you did not fully understand the scenario
1) at node creation/edition, display a list of thumbnails and be capable of selecting one of them (or multiple ones). selected images will be inserted in the node body once created.
--> i bet this can be achieved with the help of the nodereference module that is already capable of using a view that determines which nodes can be referenced. however, by default, nodereference will not display the eligibles nodes as the view does, because it uses a dropdown lists that allows multiselect. to sum it up, eligible referred node are filtered by the view, but the creation/edition form displays only a dropdown list and do not use "the rendering part of the view".
2) at node render, display image thumbnails instead of node titles (which is the default output of nodereference)
--> this can be achieved by theming and node_load
My goal is to allow the
My goal is to allow the users to go through this scenario:
1. Create a node X of some arbitrary type
2. Be able to attach a number of images (either Image nodes or CCK custom image types) under it, say I1, I2, ..., In
2.1. There should be a simple and straightforward user interface that allows the users either to upload one or more new image(s) or choose some existing one(s)
2.2. When displaying node X, there should be an easy way of customizing the display. Some possible customizations:
- Parent node X and thumbnail gallery of all "child" images beneath or on the side
- Parent node X and the first few dependent images as thumbnails plus link "more", which leads to the full gallery of "child" images
The idea is to have a real HARD link between the nodes. Not one based on taxonomy or OG but rather a fixed relationship. Imagine you want to write a blog post about your last trip and after that you want to add a number of images to it. These images will still be content items (nodes) on their own and will be commented, rated, etc. but these images BELONG to this particular trip of yours.
- When others see your post, they should also see the dependent images
- When you create the blog entry there should be a CONTEXT created by it, in which you add the images
To make an even clearer example: no images without a parent story/article/post/whatever... Every image should belong to a parent story. How can I do that?
In another discussion in this forum, it turned out Node Relativity seems to be the best candidate, however it lacks some really important features as views integration, which makes it very hard to customize.
Any other ideas?
Hi, I think what u need is
Hi,
I think what u need is webfm module (http://drupal.org/project/webfm).
The user with appropriate privileges can upload images or attach an previously uploaded image.
Does it allow for standard
Does it allow for standard picture manipulations:
- Add one or more images to a node
- Remove node images
- Show images as thumbnails like a standard gallery?
Have you found a solution yet?
I am very interested in any solutions you have.
I have created galleries of images (using this technique: http://drupal.org/node/144725) and want a new content type where users create an article and then select an appropriate (existing) image from a related gallery. I have everything working correctly, but as you described above, users currently have to select the image from a list of titles. I'd really love them to be able to view the thumbnails to make their selection.
Any help would be greatly appreciated.
Ian
Yes...
This is a very good idea, and one I'm working on.
It's almost as if we need an "Select from View" widget for Node Reference instead of a "Select List". The
<select>just doesn't always cut it. See how Multiselect did it? http://drupal.org/project/multiselect If only we could make a custom widget that should let you choose from a bunch of options graphically generated by a view and not limited to text.I've seen a few other widgets like that pop up, but not one universal enough to do what you're suggesting. If I find one, I'll let you know.
try this
http://drupal.org/project/relatedcontent -- you can use this module to select related nodes using a view. This isn't exactly what you're looking for, but it may be a start.
I'm very interested in an "Image Reference Field for CCK"
I'd like to see an "Image Reference Field for CCK" that would allow me to add an image reference field to a content type but that would have a thumbnail image viewer in the node edit area and that would also provide a more useful existing image lookup function as well as a way to add a new image node without having to leave the
BTW, I currently use Image Assist too and it's image lookup function is sorely lacking.
If I had time I'd write this CCK field and, if small enough I might even be willing to pay a bounty to have it written. Actually, I need a lot more image functionality and hope to be able to pay a significant bounty in the future to get this functionality implemented.
Can Node Reference include other fields besides title?
I am working in Drupal 6 and I have a similar need. I was thinking this could be accomplished with by using views for the node reference but perhaps that is not the intention of that feature.
What i want is to include all of the fields I specify in that view in the rendered view of my custom CCK content type.
Is this possible?
what a dream that would be
I am trying to understand how this might be possible using the .tpl file... no luck yet.
I was able to solve this by
I was able to solve this by creating a textarea field in my cck node and embedding this code (after creating the view with the fields I wanted):
<?php
print views_embed_view(viewname, $display_id = 'default', $args='args');
?>
$display_id value should be either default, page, block, etc. the display of the view you want to us
$args is optional but if you want to pass a filter to the view you can use this.
You can see how I use this on
http://bluevolt.com/products/mlms
If you click the features tab for example the content there is coming from a view that I created and I am passing in arguments to only show features for that particular product. It is displaying the title and body content of my feature node type.
Please help
This is exactly what I am intending to do as well. I have a view with nodereferences and I need to get the nodereference values to display in the view instead of the nid's. I've scoured the forums for a week and this may be the closest solution I've found.
Would you know how to display the complete nodereference values in a view?
Thanks in advance. I appreciate any help you can afford.
Nodereference views
Please see this post: http://drupal.org/node/179500 for a couple of methods to achieve what you have described.
Thread
I noticed - after reading this thread from beginning to end - that many people suggest solutions to a different problem: howto theme a node which has images as refererred nodes. This involves using views and arguments and there is lots of info on that topic as stated in the post above.
The initial question is how an admin can get an overview of thumbnails which are selectable as reference nodes (where the nodes are images using the image module) instead of the default select list offered by CCK.
I don't think there is a module for this, and I can't find any other information on this topic besides this thread. I think it should be possible to create an extension for the cck reference field for this...
You're right...
The basic problem is this:
We want a nodereference field where you can select the desired node from a set of thumbnails instead of (or aswell as) the node title.
Currently there is no full solution available. However, CCK2 already has part of this solution included because a nodereference field can now use radios/checkboxes instead of select lists (see http://drupal.org/node/282183). All that is now required is to use views to generate a list of thumbnails and combine that with the radios/checkboxes. I haven't tried this out yet, but it is possible that it already works out of the box.
Hack
I needed this as well, for the moment the work-around i use is to change line 656 in nodereference.module, but I didn't check for side-effects
function nodereference_allowed_values($field) {
$references = _nodereference_potential_references($field);
$options = array();
foreach ($references as $key => $value) {
// Views theming runs check_plain (htmlentities) on the values.
// We reverse that with html_entity_decode.
// ATTIKS $options[$key] = html_entity_decode(strip_tags($value['rendered']));
$options[$key] = html_entity_decode($value['rendered']); // <-- the magic :p
}
return $options;
}
Attiks - graphic design and web applications
I have found module
I have found module Nodereference_Explorer.
This is custom widget for nodereference which provide modal dialog with AJAX to select multiple images.
I need to add filters with Author, Gallery, and (optional) date range to fine-tune search criteria.
There is no one. And when i tried it on drupal 6.10 it worked strange.
Is it possible with radio/checkboxes to add exposed filters?
Subscribing!!
Subscribing!!
It's a bit late, but the
It's a bit late, but the original poster needs exactly this: http://drupal.org/project/nodereference_views
It will show the view of thumbnails in place of the CCK list of bare image names.
Only on the node view page
This module looks good, but it only works on the nodes view page. The goal here is to display a list of images on the nodes edit page so that you can select an image instead of a filename or a node title.
ian
Fantasy Formula 1
Probably this is the solution...
http://drupal.org/project/nodereference_explorer
--
Ing. Eligio Colutta
Pulse s.a.s.
http://www.pulsetech.it