roots / sage

WordPress starter theme with Laravel Blade components and templates, Tailwind CSS, and a modern development workflow
https://roots.io/sage/
MIT License
12.72k stars 3.06k forks source link

Theme can not load images #343

Closed hungrysquirrel closed 12 years ago

hungrysquirrel commented 12 years ago

I can not seem to unravel this mystery. I uploaded a new image inside my roots/img/my_image.png

I get 404's on the image (my_image.png) when I try to use it in my theme. The other two images in that folder by default (glyphicons) load fine.

swalkinshaw commented 12 years ago

Please include:

hungrysquirrel commented 12 years ago

Thanks for having a look,

blog.estately.com

404 image http://blog.estately.com/img/estately_logo.png

working image example http://blog.estately.com/img/glyphicons-halflings.png

I tried the following in the header.php img src="http://www.blog.estately.com/img/estately_logo.png" img src="img/estately_logo.png"

And in my CSS background: url("../img/estately_logo.png") no-repeat 0 0;

swalkinshaw commented 12 years ago

Since your WP install is at the root of your subdomain, it's easier/safer to just use "/img/whatever.jpg".

Notice the leading /

So:

src="/img/estately_logo.png"
background: url("/img/estately_logo.png") no-repeat 0 0;
hungrysquirrel commented 12 years ago

Tried this with the basic img tag img src="/img/estately_logo.png" width="243" https://skitch.com/hungrysquirrel/8kp87/estately-blog

in CSS this also is not working background: url("/img/estately_logo.png") no-repeat 0 0;

Still 404's

swalkinshaw commented 12 years ago

Well, here's how the bootstrap images are referenced:

background-image:url("../img/glyphicons-halflings.png")

If that image works, and your img file is in the same directory, and you reference it the same way in your CSS, then it should work.

hungrysquirrel commented 12 years ago

I tried this already. https://github.com/retlehs/roots/issues/343#issuecomment-4525457 using the background property.

Also fails background-image: url("../img/estately_logo.png");

This is very odd to me. The site only works now because I call in a remote image from our domain :(

swalkinshaw commented 12 years ago

I know you already tried it. My point was that there's no reason it shouldn't work if the glyphicons-halflings image is working.

hungrysquirrel commented 12 years ago

@swalkinshaw Sorry. Hope I didn't frustrate you. Any recommendations? Guess I can try seeing up a sandbox install. Obviously it's not a widespread issue which is good for the project and sad for me.

swalkinshaw commented 12 years ago

I'm sure you're the one who's frustrated with it not working so don't worry about me.

You could try commenting out this line: https://github.com/retlehs/roots/blob/master/functions.php#L18

Then delete your .htaccess file and make sure it regenerates. After that, the /img/ rewrite won't work so try accessing the image normally through the full theme url. See if that works.

Pegic commented 12 years ago

Thanks swalkinshaw, commenting out that line worked for me as I was also having the same problem, but what could be causing it?

retlehs commented 12 years ago

permalinks needed to be flushed? .htaccess missing the rewrites for /img/ and the rest?

please post on http://groups.google.com/group/roots-theme if you still have issues