MyBB Community Forums

Full Version: Removing a Theme IMGDIR restriction
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Currently this code exists in global.php

if(!@is_dir($theme['imgdir']))
{
	$theme['imgdir'] = "images";
} 

This prevents me from using an external server for my images. It will not recognize http://img.domain.com/images if I chose to break up my server load.

Please consider a small change to allow external image servers.
Is this in place for any other reason?
Also the next section does an isdir check for languages. That also should be altered. I am setting up an img.hackforums.net server now. I am making custom edits but I don't see why MyBB doesn't change this to allow an external image directory.
Shouldn't be too hard to remove that bit of code yourself for the time being Smile
Yes I did that. This is the suggestions forum not support. I thought it a good idea that MyBB consider this change to allow for it.
I agree Smile
I would be curious on the telemetry on how many forum's theme's we would break with that small change.

And if you'd like you can probably hook into global_end and query the actual theme row and override that variable (Haven't taken a look at it to confirm).
(2009-09-02, 09:25 PM)Ryan Gordon Wrote: [ -> ]And if you'd like you can probably hook into global_end and query the actual theme row and override that variable (Haven't taken a look at it to confirm).

Nope, if any of the "global" templates (i.e. header and the like) use the imagedir, they'll be evaluated before anyone has a chance to change the variable. He'd be in the same boat as me when it comes to needing someone to add a hook after the theme and template set are selected but before any of the global templates are evaluated.
From what I see you don't break any templates. It MIGHT break something if it uses bburl setting and then imgdir....like the smilies do in inc/class_parser.php. So from what I can tell it's just a matter of fixing 2 files a few lines to allow the themedir to be external http server and not do an isdir().

IMHO for the small effort it's a big bang for a MyBB feature. As my site grows I don't want to be forced to make crazy amounts of custom core file edits to accomodate the size. As you know from NCAABBS having to slice apart MyBB sort of sucks. IMHO...once I start making too many core file edits that's when I know I have outgrown a software and start looking for alternatives. MyBB needs to be able to scale into a few million posts for me. I am at 1.2 million with 8000+ per day. I should be well over 2 million posts by the new year. HF will be the largest MyBB forum within 18 months imho. I don't mind having to buy more hardware but I do mind having to tear apart the software to suit my needs.

Oh and I am sure you have seen this but just in case:
http://community.mybboard.net/thread-55888.html

That highlights some changes. The only thing is the global change that would need better testing. I am sure my hack isn't the best available code change. I just made a simple adjustment for my site since it's not multilingual.

And this can't be achieved with a plugin I don't think. Default templates are already eval'd by the time you hit global_end and global_start is too early to make the change.

So basically besides the smilie this is the only part that appears to need a rewrite:

if(!@is_dir($theme['imgdir']))
{
	$theme['imgdir'] = "images";
} 

// If a language directory for the current language exists within the theme - we use it
if(!empty($mybb->user['language']) && is_dir($theme['imgdir'].'/'.$mybb->user['language']))
{
	$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->user['language'];
}
else
{
	// Check if a custom language directory exists for this theme
	if(is_dir($theme['imgdir'].'/'.$mybb->settings['bblanguage']))
	{
		$theme['imglangdir'] = $theme['imgdir'].'/'.$mybb->settings['bblanguage'];
	}
	// Otherwise, the image language directory is the same as the language directory for the theme
	else
	{
		$theme['imglangdir'] = $theme['imgdir'];
	}
}
What if it was an option? Not removed? That way it doesn't have to break anything?
Pages: 1 2 3