Hello,

Does image field store to the db?

If so what code do i use to grab the image uploaded to a node?

I have a query that pulls the title and content of my news pages but I need it to also pull the uploaded image associated with the news pages as well as the title and content.

SELECT node.title, node.created, node.nid, content_field_excerpt.field_excerpt_value ..... I have no idea what to use to target the uploaded image. If the image is not in the db to begin with I guess im back at square one trying to figure out how to pull the images.

Any suggestions will be greatly appreciated!

Comments

designerdre101’s picture

Here is my scenario:

URL - http://www.integragroup.com/news/articles

Here is the code that generates that listing:


$taxo_id = 2;
$list_no =20;
$sql = "SELECT node.title, node.created, node.nid, content_field_excerpt.field_excerpt_value FROM node INNER JOIN term_node ON node.nid = term_node.nid INNER JOIN content_field_excerpt ON node.nid = content_field_excerpt.nid WHERE (term_node.tid = $taxo_id) ORDER BY node.created DESC LIMIT $list_no";
print "<table border='0' class='itemlisting'>";
$result = db_query($sql);
while ($anode = db_fetch_object($result)) { 
print format_date($anode->created, 'custom', 'F d, Y');

print l($anode->title, "node/".$anode->nid);

print l($anode->field_excerpt_value, "node/".$anode->nid);

print l("Read More...", "node/".$anode->nid);
}
print "</table>";

The goal is to have a thumbnail associated with each item in the listing. I have installed the imagefield module and added a image field called field_article_image_thumb to the news content type (those are news pages in the listing).
The field works fine...it uploads the file to the folder i specified successfully.

How do I now update the code above to not only pull node.created, node.nid, content_field_excerpt etc.. but also to include the image for each post?

I realize that the image is not stored in the db but the path to the image is. If i could even access the path and know how to print it that would work for me as well.

I realize how powerful drupal can be and as this is the first Drupal site i'm working on I want to learn the ropes rather than quit for an easier CMS...I think this is worth it.

Thanks you very much!

WorldFallz’s picture

I'm not sure what you're trying to code there-- but why not just use the imagecache module, which has been added to core for d7, for thumbnails?