I have a imagefield in views set to "hide from view".

How do I, using phpfield (manipulates the db results directly, row for row) view this image?
Im trying to create an advanced view, which displays the image on some conditions, and some not.

In other words, what PHP code is used to view an imagefield image in views?

Comments

tomotomo’s picture

What's "views php field"?

farald’s picture

It's a custom module that acesses the row data directly, example:

<?php 

print $data->node_title;
print $data->node_data_field_global_description_field_global_description_value;
?> 

http://drupal.org/project/views_customfield

So it should be simple to output an image (using imagecache preset "thumb"), I just can't figure out how:)

farald’s picture

Title: View imagefield image in views using php and "views php field » View imagefield image in views using php and "views custom field" module
AdrianB’s picture

Did you solve this?

I'm looking for the same information right now, how to use the $data object to print an imagecache image using php in views custom field.

AdrianB’s picture

Nevermind, I solved it.

Here's an example using an multivalue image field named "image" and a imagecache preset named "imagecache-preset":

$file = field_file_load($data->node_data_field_image_field_image_fid[0]['fid']);
$img = theme('imagecache', 'imagecache-preset', $file['filepath']);
print $img;
quicksketch’s picture

Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

gaintsev’s picture

Thank you!