Ability to move images and thumbnails to a seperate domain/URL

This commit is contained in:
Savetheinternet 2011-03-17 18:56:18 +11:00
parent 9c9ead2b08
commit 0156daaf55
3 changed files with 27 additions and 5 deletions

View File

@ -66,7 +66,7 @@
// Same as above but different IP address
$config['flood_time_same'] = 30;
// Do you need a body for your non-OP posts?
$config['force_body'] = true;
$config['force_body'] = false;
// Reject blank posts? (just whitespace, etc)?
$config['reject_blank'] = true;
@ -186,6 +186,15 @@
//$config['image_deleted'] = $config['dir']['static'] . 'deleted.png';
//$config['image_zip'] = $config['dir']['static'] . 'zip.png';
// If you want to put images and other dynamic-static stuff on another (preferably cookieless) domain, you can use this:
// This will override $config['root'] and $config['dir']['...'] directives
// "%s" will get replaced with $board['dir'], which usually includes a trailing slash. To avoid double slashes, you don't need
// to put a slash after %s
// $config['uri_thumb'] = 'http://images.example.org/%sthumb/';
// $config['uri_img'] = 'http://images.example.org/%ssrc/';
// If for some reason the folders and static HTML index files aren't in the current working direcotry,
// enter the directory path here. Otherwise, keep it false.
$config['root_file'] = false;
@ -314,6 +323,8 @@
$config['mod']['createusers'] = ADMIN;
// View the moderation log
$config['mod']['modlog'] = ADMIN;
// Create a PM (viewing mod usernames)
$config['mod']['create_pm'] = JANITOR;
// Mod links (full HTML)
// Correspond to above permission directives

View File

@ -194,7 +194,7 @@
// File info
if(!empty($this->file) && $this->file != 'deleted') {
$built .= '<p class="fileinfo">File: <a href="' . $config['root'] . $board['dir'] . $config['dir']['img'] . $this->file .'">' . $this->file . '</a> <span class="unimportant">(' .
$built .= '<p class="fileinfo">File: <a href="' . $config['uri_img'] . $this->file .'">' . $this->file . '</a> <span class="unimportant">(' .
// Filesize
format_bytes($this->filesize) . ', ' .
// File dimensions
@ -208,7 +208,7 @@
$built .= ', ' . $this->filename . ')</span></p>' .
// Thumbnail
'<a href="' . $config['root'] . $board['dir'] . $config['dir']['img'] . $this->file.'"><img src="' . $config['root'] . $board['dir'] . $config['dir']['thumb'] . $this->thumb.'" style="width:'.$this->thumbx.'px;height:'.$this->thumby.'px;" /></a>';
'<a href="' . $config['uri_img'] . $this->file.'"><img src="' . $config['uri_thumb'] . $this->thumb.'" style="width:'.$this->thumbx.'px;height:'.$this->thumby.'px;" /></a>';
} elseif($this->file == 'deleted') {
$built .= '<img src="' . $config['image_deleted'] . '" />';
}
@ -311,7 +311,7 @@
public function build($index=false) {
global $board, $config;
$built = '<p class="fileinfo">File: <a href="' . $config['root'] . $board['dir'] . $config['dir']['img'] . $this->file .'">' . $this->file . '</a> <span class="unimportant">(' .
$built = '<p class="fileinfo">File: <a href="' . $config['uri_img'] . $this->file .'">' . $this->file . '</a> <span class="unimportant">(' .
// Filesize
format_bytes($this->filesize) . ', ' .
// File dimensions
@ -324,7 +324,7 @@
// Filename
$built .= ', ' . $this->filename . ')</span></p>' .
// Thumbnail
'<a href="' . $config['root'] . $board['dir'] . $config['dir']['img'] . $this->file.'"><img src="' . $config['root'] . $board['dir'] . $config['dir']['thumb'] . $this->thumb.'" style="width:'.$this->thumbx.'px;height:'.$this->thumby.'px;" /></a>';
'<a href="' . $config['uri_img'] . $this->file.'"><img src="' . $config['uri_thumb'] . $this->thumb.'" style="width:'.$this->thumbx.'px;height:'.$this->thumby.'px;" /></a>';
$built .= '<div class="post op"><p class="intro"' . (!$index?' id="' . $this->id . '"':'') . '>';

View File

@ -46,6 +46,17 @@
if(!isset($config['image_zip']))
$config['image_zip'] = $config['dir']['static'] . 'zip.png';
if(!isset($config['uri_thumb']))
$config['uri_thumb'] = $config['root'] . $board['dir'] . $config['dir']['thumb'];
else
$config['uri_thumb'] = sprintf($config['uri_thumb'], $board['dir']);
if(!isset($config['uri_img']))
$config['uri_img'] = $config['root'] . $board['dir'] . $config['dir']['img'];
else
$config['uri_img'] = sprintf($config['uri_img'], $board['dir']);
if($config['root_file']) {
chdir($config['root_file']);
}