Hi,
I know that for calling ImageCache there is function:

print theme('imagecache', 'profile_name', $img_url, 'just a test image', 'test image');

but it does not seam to work for me....
I am trying to link an image to nodes file attachment to get some extra flexibility I am trying to do it in Views adding custom php field. So the code I am using looks like this:

<?php
//Gets nodes attainment`s file path
$node = node_load($data->nid);
$file = upload_load($node);
$file_path = $file[array_shift(array_keys($file))]->filepath;
//Just to make sure it received the data
echo $file_path;
//Checking file path of first attached image (works fine) 
echo $node->field_image_name[0][filepath];
$img_src = $node->field_cover[0][filepath];
//Does not show any results
print theme('imagecache', 'profile name', $img_src, 'just a test image', 'test image');
//Results in a link to attachment file with text of "> may be I missed something?
echo '<a href="'.$file_path.'"><img class="" title="" alt="" src="'.theme("imagecache", "cover", $img_src).'"></a>';
?>

Thanks for help in advance :)

Comments

drewish’s picture

Status: Active » Postponed (maintainer needs more info)

I'm having a hard time trying to understand what your code does. Is the image stored with upload module or an imagefield? you seem to be using both. If it's an imagefield just use the built in CCK field formatter support. If it's stored with upload module just drop this whole bit:

echo $node->field_image_name[0][filepath];
$img_src = $node->field_cover[0][filepath];
POVYLAZZZ’s picture

Oh sorry I just wanted to make fields name clear but I have not renamed it everywhere.
$node->field_image_name[0][filepath] === $node->field_cover[0][filepath]

fizk’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)