Go to main content

Textpattern CMS support forum

You are not logged in. Register | Login | Help

#1 2007-02-17 16:12:16

dilate_media
New Member
Registered: 2007-02-17
Posts: 3

Linking to images in css.

Hey.
Im new to this forum and to txp.
i just recently installed it on my server and im having problems linking to my images from my css file.
I have strong xhtml and css knowledge.. but have never worked with a cms other than contribute.

I have tried using absolute and local paths in my links, ive also tried uploading the images to my server outwith txp and linking to it that way, again ive tried both absolute and local paths…

Ive also tried using the filename txp seems to give my image which was called “topBar.jpg” but now seems to be called “4.jpg”

Does anyone have any ideas what im doing wrong?

p.s forgot to mention.. im storing my images in the “content > images” section in the “site-design” category

Thanks in advance.
Chris.

Offline

#2 2007-02-17 16:31:23

colak
Admin
From: Cyprus
Registered: 2004-11-20
Posts: 9,091
Website GitHub Mastodon Twitter

Re: Linking to images in css.

txp changes the name of your image to a number.
url for that image would normally be /images/4.jpg


Yiannis
——————————
NeMe | hblack.art | EMAP | A Sea change | Toolkit of Care
I do my best editing after I click on the submit button.

Offline

#3 2007-02-17 17:13:02

Elenita
Member
From: Falls Church, VA
Registered: 2004-05-16
Posts: 407
Website

Re: Linking to images in css.

Also keep in mind that Textpattern generates the CSS from information stored in the database. If you use relative paths, make sure they’re relative to the Textpattern backend, not the root of your site.

Offline

#4 2007-02-17 17:13:13

squaredeye
Member
From: Greenville, SC
Registered: 2005-07-31
Posts: 1,495
Website

Re: Linking to images in css.

Chris,
I store all my css images outside of the Textpattern system. I find it makes more sense when you use naming conventions for your css images, and for making changes later. I store most of my stuff in css/images/.

FWIW.

Matthew


Offline

#5 2007-02-17 20:25:11

dilate_media
New Member
Registered: 2007-02-17
Posts: 3

Re: Linking to images in css.

yeah ive tried all that…
im beginning to think it may be something else other than the paths im using…

not really sure tho.
open to suggestions though.

Chris.

Offline

#6 2007-02-17 20:56:53

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Linking to images in css.

What does it say in Admin > advanced preferences for ‘Image directory’?

Offline

#7 2007-02-17 21:10:39

dilate_media
New Member
Registered: 2007-02-17
Posts: 3

Re: Linking to images in css.

it says the image directory is “images”

Offline

#8 2007-02-17 23:14:19

els
Moderator
From: The Netherlands
Registered: 2004-06-06
Posts: 7,458

Re: Linking to images in css.

Then /images/4.jpg should work. You could also try ../images/4.jpg. Or try using the full url (http://yoursite.com/images/4.jpg) to check if the image name is correct.

Offline

#9 2008-12-04 06:15:30

christopheradams
Member
Registered: 2008-12-04
Posts: 11

Re: Linking to images in css.

Els, I had the same question and found this topic through a search.

For getting images to display from CSS, following the convention ../images/4.jpg worked for me, as in:

background: transparent url(../images/10.gif) no-repeat 0 6px;

Thanks.

Offline

Board footer

Powered by FluxBB