Okay let me set this up for you guys....

I just converted a website template to drupal. I'm using IMG tags like this: img src="images/nav_space.jpg" height="46" width="180" . The images are definitely located in the 'images' folder, they even display within Dreamweaver, however when I ftp everything and go to my URL those images aren't displaying. When the page loads the outline of the images will appear and then drupal quickly removes them.

In addition, I have a css file that references images that are located in that same 'images' folder. For example the body tag:

body
{
background-image: url(../images/bkg_off.jpg);
}

...has no problem displaying the image.

I just don't get it...

Comments

WorldFallz’s picture

The outline is probably coming from the height/width attributes, it has nothing to do with the image itself. Where is the images folder in relation to your drupal installation?

smitty2008’s picture

Here's the path:

/public_html/themes/myTheme/images

...also I just copied that image into the drupal *files* folder and then hardcoded the absolute path within the IMG tag and it displays now.

But the issue still hasn't been solved as to why my relative IMG tag doesn't work. Please don't tell me I have to put all my images into the Files folder...

smitty2008’s picture

double post ... ignore

clivesj’s picture

did you set your input filter to full HTML? Otherwise it will get filtered.

smitty2008’s picture

I have full html set, but the IMG tag I'm having trouble with is part of the website design. The problem isn't posting a page or story and referencing an img during that process.

c-m’s picture

I don't really know anything about theming and have been reading around.

I read somewhere what when converting your html to tpl.php not to use image/filename.jpg and instead you should use some type of phpcode/filename.jpg

I can't remember what the code was though sorry.

smitty2008’s picture

Here's my fix:

Use the base_url variable by inserting the following above your head tag:

global $base_url;

...then in your image tags write them like this:

src=" print $base_url . '/' . $directory . '/images/' . 'nav_space.jpg' " height="46" width="180"

...they display now...

WorldFallz’s picture

exactly-- you beat me to it, lol.