cvs: phpweb /include layout.inc
| From: | Wez Furlong | Date: | Thu, 15 May 2003 16:36:04 +0000 |
| Subject: | cvs: phpweb /include layout.inc | ||
| Groups: | php.mirrors | ||
| Request: | Send a blank email to php-mirrors+get-17700@lists.php.net to get a copy of this message | ||
wez Thu May 15 12:36:04 2003 EDT
Modified files:
/phpweb/include layout.inc
Log:
Route images via thttpd for www.php.net site itself.
# phpweb guys: please make it a point to try and use make_image() function
# for generating images where you can. It allows us to manage the load
# a little easier
Index: phpweb/include/layout.inc
diff -u phpweb/include/layout.inc:1.152 phpweb/include/layout.inc:1.153
--- phpweb/include/layout.inc:1.152 Thu May 15 09:27:40 2003
+++ phpweb/include/layout.inc Thu May 15 12:36:04 2003
@@ -1,6 +1,6 @@
<?php
-/* $Id: layout.inc,v 1.152 2003/05/15 13:27:40 goba Exp $ */
+/* $Id: layout.inc,v 1.153 2003/05/15 16:36:04 wez Exp $ */
// Print an image for a sized spacer
function spacer($width = 1, $height = 1, $return = false, $align = false, $extras = false)
@@ -31,12 +31,21 @@
function make_image($file, $alt=false, $align=false, $extras=false, $dir=false, $border=0) {
global $HTTP_SERVER_VARS;
+ static $image_root = null;
+
+ if ($image_root === null) {
+ $image_root = ($HTTP_SERVER_VARS['SERVER_NAME'] == 'www.php.net') ? 'http://64.246.30.196/www.php.net' :
'';
+ }
+
if (!$dir) {
$dir = '/images';
}
+
+ $webdir = $image_root . ($dir{0} == '/' ? '' : '/') . $dir;
+
if ($size = @getimagesize($HTTP_SERVER_VARS['DOCUMENT_ROOT'].$dir.'/'.$file))
{
$image = sprintf('<img src="%s/%s" border="%d" %s alt="%s"
%s%s />',
- $dir,
+ $webdir,
$file,
$border,
$size[3],
@@ -46,7 +55,7 @@
);
} else {
$image = sprintf('<img src="%s/%s" border="%d" alt="%s"
%s%s />',
- $dir,
+ $webdir,
$file,
$border,
($alt ? $alt : ''),