I would like to get the image path of a field. I'm in a node and I need the Url of image in order to put it as a background-image in inline css. I can't find the solution. Can you help me?
相关问题
- Drupal 8: How do I customize a form widget to show
- How to balance webserver bandwith usage?
- drupal :: order complete hook and upgrade user per
- Change redirect in Drupal 7 for Password Recovery
- Adding attachment to Jira's api
相关文章
- Render a Drupal node
- How to allow multiple blocks in a module of Drupal
- How can I redirect a Drupal user after they create
- Drupal 6: Getting custom fields into the database
- Drupal 7 retain file upload
- Drupal - Set 'user/%/edit/uprofile' to def
- Drupal Session User id for independent script
- how to construct an https POST request with drupal
I sometime use this:
To get just the path of an image from it's URI:
More information on file_create_url() can be found here: http://api.drupal.org/api/drupal/includes%21file.inc/function/file_create_url/7
To get the path of an image created using an image style from it's URI use:
More information on image_style_url() can be found here: http://api.drupal.org/api/drupal/modules!image!image.module/function/image_style_url/7
to get image style url:
You also can use the Image URL Formatter module. It allows to change the field format in order to get only the URL:
Bonus: it works with Views as well:
I am afraid, none of the solutions above are correct. They don't follow Drupal standards.
More details here: http://www.computerminds.co.uk/articles/rendering-drupal-7-fields-right-way