Image paths in Drupal 7

How to code a path to an image from a Drupal block or node?

To soft wire a path from a block or node to an image where the image is on the Sites folder inside the Files folder, inside an Image folder, use the following path:

sites/default/files/images/name_of_picture.jpg

Why use the Sites folder? for upgradeability purposes.

Anything outside the Sites folder may be deleted automatically during a core upgrade.

Your domain name is the root directory. Sites is one level bellow. Inside Sites there are two other folders, All and Default. Your modules and themes should go inside the All folder and your images generally go on the Default folder. Either way, your path starts from Sites ( no trailing slash).

This information is for those modifying the platform by themselves or for other web coders looking for quick answers. If I built the framework of your site you don't have to worry about this because I already did.

Comments

A simple image tag needs to be:
<img src="../sites/default/files/images/MyPic.jpg">

Leading "../" just like "node" refs. Hope this helps another newbie.

Thanks for your OP - who knows how many hours it saved me given the difficulty in finding anything useful in the docs / help.