Hello,
..
I created a CCK node type "GalleryImage"... I use this with imagecache and a few other modules to create an image gallery...
Now, I would like to have a block on the sidebar with the Latest "GalleryImage" node and the corresponding thumbnail..
I am trying to do this with views.. following comes the export... The image is just not showing up, rather just a grey block a few pixel high and as wide as the sidebar...
I also tried with Recent Blocks, but I can only get it display the node's title and not the imagefield as thumb...
I also thought that the block may be coded in PHP, but I did not find a great deal of code googling around... if anyone has a snippet it would b great.. strange I wuold have thought to find heaps of this kind of stuff
view export
$view = new stdClass();
$view->name = 'Recent_Image';
$view->description = '';
$view->access = array (
);
$view->view_args_php = '';
$view->page = FALSE;
$view->page_title = '';
$view->page_header = '';
$view->page_header_format = '1';
$view->page_footer = '';
$view->page_footer_format = '1';
$view->page_empty = '';
$view->page_empty_format = '1';
$view->page_type = 'node';
$view->url = '';
$view->use_pager = TRUE;
$view->nodes_per_page = '10';
$view->block = TRUE;
$view->block_title = '';
$view->block_header = '';
$view->block_header_format = '1';
$view->block_footer = '';
$view->block_footer_format = '1';
$view->block_empty = '';
$view->block_empty_format = '1';
$view->block_type = 'node';
$view->nodes_per_block = '2';
$view->block_more = FALSE;
$view->block_use_page_header = FALSE;
$view->block_use_page_footer = FALSE;
$view->block_use_page_empty = FALSE;
$view->sort = array (
);
$view->argument = array (
);
$view->field = array (
array (
'tablename' => 'node',
'field' => 'title',
'label' => '',
'handler' => 'views_handler_field_nodelink',
'options' => 'link',
),
);
$view->filter = array (
array (
'tablename' => 'node',
'field' => 'status',
'operator' => '=',
'options' => '',
'value' => '1',
),
array (
'tablename' => 'node',
'field' => 'type',
'operator' => 'OR',
'options' => '',
'value' => array (
0 => 'galleryimage',
),
),
);
$view->exposed_filter = array (
);
$view->requires = array(node);
$views[$view->name] = $view;
Comments
Your export only gets the
Your export only gets the title field, it needs to get the field with the image.
Sorry, this is the export
I had tried without the image field and only the node title...
But even the node title itself is not showing up.
This is the export of the view with the image field in it... it does not work... like I explained in my previous post..
Simplicity is the ultimate sophistication, Leonardo da Vinci
This may be helpful...
Was having a similar issue and solved it by styling the block in the node-nodetype.tpl.php in the theme.
You can have a conditional that displays teaser view, block view and node view for the specific content type.
The example above isn't using imagefield, but uses a filename that gets bulk uploaded. Imagefield is more straightforward, from what I recall.
You can also check the display settings on your node type - and check the size for imagecache in different situations so that the image gets called.
Also be sure that you're using GD php library. Not using GD made it so that the image didn't get created the first time it was called - thus creating the gray line of the appropriate width on the first call.
Thanks it was
The following is what I placed into the node-galleryimage.tpl.php
I just had to remove the teaser condition for what I need.
Simplicity is the ultimate sophistication, Leonardo da Vinci