MyBB Community Forums

Full Version: Directory Issues - Displaying Images
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Ive noticed from time to time if I create a new folder in my root, add a custom mybb page inside that folder some images wont display.

When right clicking the image on the custom page to see its location it is looking for the "images" folder inside the new folder rather than looking for the current themes images folder. I have tried adding {$theme['imgdir']} but it still looks for the images folder inside the new folder.

So basically the page should look for the image like so:
Quote:images/filename.png

But instead its looking for:
Quote:newfolder/images/filename.png

The page itself is displaying so "require_once "../global.php";" is correct.

Any ideas ?
Is it possible your image directory is set wrong?

Check here ACP->Templates And Styles->Your Theme->Image Directory
No the entire site is displaying images, its just custom pages that are inside a folder in the forum root that don't seem to want to display some images.
Have you tried adding ../ in front of {$theme['imgdir']}?
Might be easier to see where the problem is if you post the code used Toungue
Oh okay I understand. The image path is probably wrong.

If its like this
<img src="/images/filename.jpg"> 
Change it to
<img src="images/filename.jpg>
Or
<img src="../images/filename.jpg>

And just a quick tip, when trying to figure out whats wrong with image paths, try right clicking the broken image, and clicking display image in new tab, then add
../
for each directory up the page opened to.
I dont really have physical example. But the problem is when I create a custom page, using something like this:

<?php

define('IN_MYBB', 1); 
require "../global.php"; 

add_breadcrumb("Rules page", "rules.php"); 

eval("\$rules = \"".$templates->get("rules")."\";"); 
output_page($rules); 
?>

The default search, memberlist images wont display on the custom page but they will display as normal on all other pages (index, header etc..)

Remember that the custom page is not in the root, its in a folder in the root.
Could you possibly post a link to one of these custom pages? Smile
You can just put an image folder in new folder and put just those images you need in it.
(2012-08-06, 04:50 PM)Ted B Wrote: [ -> ]You can just put an image folder in new folder and put just those images you need in it.

I would use that as a last resort. Not only does it take time to sort all images you're going to need. Copying images simply wastes server space.
Found a solution. If you set your image directory to your images folder with http:// i.e. http://yourforum.com/images rather than just images then it will work fine Toungue
Pages: 1 2