0

I'm working on a module that will display images, so for this module I created a specific content type. One of the fields from this content type is an image, named field_ssimage.

I found the table in my database named field_data_field_ssimage, but there is no column that contains the URL. I was thinking of writing an SQL statement to get all my image URLs so that I could output them in the img tags, but to no prevail.

Where can I find this URL? Or am I approaching the problem in entirely the wrong way?

Neglexis
  • 111
  • 1
  • 1
  • 12

1 Answers1

0

Fields in Drupal get their own table as the table you mentioned. In your case table field_data_{field_ssimage} belongs to the field_ssimage field. In this table there is a column {field_ssimage}_fid containing the File ID of your image. In the file_managed table there is a record with corresponding fid having a URI value. So basically that's the table you'll be needing.

Make sure to render images to the frontend with the Drupal image theme function: theme_image($variables)

baikho
  • 5,203
  • 4
  • 40
  • 47
  • Oh great, thanks a bunch! Didn't know which other table to look in. Is it actually the 'correct' way to do this? I come from a database administrator background, so I'm more comfortable with SQL statements, which is why I thought of doing it this way. – Neglexis Dec 27 '14 at 14:05
  • Yes but make sure to get the data with the Drupal API. Take a look at [Static queries](https://www.drupal.org/node/310072). Good luck! – baikho Dec 27 '14 at 14:17
  • Thanks again. I've built my first module through a Drupal guide, and even for the select statement there they used a dynamic query. But is there a difference (performance, security, ...) between static and dynamic queries when talking about select statements? – Neglexis Dec 27 '14 at 14:24