Closed (fixed)
Project:
ImageCache
Version:
6.x-2.0-beta9
Component:
Code
Priority:
Minor
Category:
Support request
Assigned:
Reporter:
Created:
22 Dec 2010 at 11:18 UTC
Updated:
24 May 2012 at 07:40 UTC
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
Comment #1
drewish commentedI'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:
Comment #2
POVYLAZZZ commentedOh 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]
Comment #3
fizk commented