From 0156daaf553f382a32c6e36287dbbfea868fc52b Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Thu, 17 Mar 2011 18:56:18 +1100 Subject: [PATCH] Ability to move images and thumbnails to a seperate domain/URL --- inc/config.php | 13 ++++++++++++- inc/display.php | 8 ++++---- inc/functions.php | 11 +++++++++++ 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/inc/config.php b/inc/config.php index d56e4344..66c9c00f 100644 --- a/inc/config.php +++ b/inc/config.php @@ -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 diff --git a/inc/display.php b/inc/display.php index 41b99461..cc890ee6 100644 --- a/inc/display.php +++ b/inc/display.php @@ -194,7 +194,7 @@ // File info if(!empty($this->file) && $this->file != 'deleted') { - $built .= '

File: ' . $this->file . ' (' . + $built .= '

File: ' . $this->file . ' (' . // Filesize format_bytes($this->filesize) . ', ' . // File dimensions @@ -208,7 +208,7 @@ $built .= ', ' . $this->filename . ')

' . // Thumbnail - ''; + ''; } elseif($this->file == 'deleted') { $built .= ''; } @@ -311,7 +311,7 @@ public function build($index=false) { global $board, $config; - $built = '

File: ' . $this->file . ' (' . + $built = '

File: ' . $this->file . ' (' . // Filesize format_bytes($this->filesize) . ', ' . // File dimensions @@ -324,7 +324,7 @@ // Filename $built .= ', ' . $this->filename . ')

' . // Thumbnail - ''; + ''; $built .= '

'; diff --git a/inc/functions.php b/inc/functions.php index ba8a1ad0..69cd8444 100644 --- a/inc/functions.php +++ b/inc/functions.php @@ -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']); }