Adding content with images - basic

Last modified: September 19, 2007 - 07:15

With Drupal you can add images to your content. How it is
displayed still depends on the theme you are using and the CSS included
handles the IMG tag.

  1. Enable upload module
  2. Set your role as allowed to upload files
  3. Check your space and attachment settings administer > site configuration > file uploads
  4. Enable your content type for uploads
  5. Create content
  6. Attach file - uncheck List file, copy the file path under the box once it's uploaded.

    Now you can use <img src="path/image.png" /> in the content area.

    Note

    Assumes your filter allows the use of <img>

Expanding on point (6)

cog.rusty - October 21, 2007 - 00:18

Expanding on point (6)

Image paths in the content

When you copy the path of the uploaded file into the content to place the image, the correct way to specify "img src=" depends on your site's setup. Assuming that "filepath" is your Drupal images directory:

a) If you are using Clean URLs, then specify an absolute domain-independent path:
- When a site is accessed as http://example.com then use "/filepath/image.png".
- When a site is accessed as http://example.com/drupalsite then use "/drupalsite/filepath/image.png".

b) If you are not using Clean URLs, then (a) is still OK, but you have a simpler alternative: You can always specify only a relative path, for example "filepath/image.png" (without a front slash), no matter whether the site is accessed as a subdirectory or not.

Obviously a fully qualified URL for an image ("http://example.com/filepath/image.png") will always work as long as your site's domain remains the same.

Note: When switching between "Clean URLs" and "no Clean URLs" or when changing a site's URL path, image links may break if you don't take into account these differences.

 
 

Drupal is a registered trademark of Dries Buytaert.