Hi

Can you please add some info into documentation about using image field values from database?
I am trying to build block for blog pages with some info about blog author ,
I get all info right from db, from my own cck type table, datas from text inputs are ok, bud datas for image fields are numbers - and I have no idea what I can do with it (I just can show image, need url).
I searched all cck handbook, but no info about using image field values from database are there.

Thanks for your (small) info how can we use / convert image field values from database for showing image.
I am using drupal 5.3, CCK all modules, nodeprofile (each user have own nodeprofile with CCK fields), views
Igor
www.somvprahe.sk

Comments

igorik’s picture

it had to be "I just WANT to show image, need url" not can.

igorik’s picture

I found a solution:

I removed all selects from cck content type table and now I use node_load for page with required fields.
I don't know if it is the best and the most elegant solution, but it works fine.

<?php
if ( arg(0) == 'node' && is_numeric(arg(1)) && ! arg(2) ) {
$node = node_load(arg(1));

$sql = "
SELECT n.nid FROM node n WHERE (
n.type = 'uprofile' AND $node->uid = n.uid)";
$result = db_query($sql);
$row = db_fetch_object($result);
$node_loaded = node_load($row->nid);
?>
<img width="196px" src="http://www.somvprahe.sk/<?php  print $node_loaded->field_profil_fotografia1[0]['filepath'] ?>" />
<?php
}
 ?>

probably it will be better use something like get_path (or what it is exactly) instead full url in image source.

Igor
www.somvprahe.sk

dopry’s picture

Status: Active » Closed (fixed)