I am creating a module in Drupal 7. If I want to format a UNIX timestamp into a date I can use the format_date function, like so:
$date = format_date($node->created, 'custom', 'j F Y');
Is there also a function I can reference to format an image? Say my database query returns
picture-4-136576449.png
from a table and I want to transform it into:
<img src="/images/picture-4-136576449.png />
is there a function to do it? Thanks.
If you are trying to convert a
URIto a URL, you are doing it wrong.If you know the path to the image relative to Drupal root, use
You can theme an image using
theme('image', $variables).ex:
You can see the other variables at theme_image() function doc page.