[2] | 1 | <? |
---|
| 2 | |
---|
| 3 | //************************** BEGIN CONFIGURATION *****************************// |
---|
| 4 | |
---|
| 5 | //example, this is the actual file system path |
---|
| 6 | //of the web server document root. e.g. |
---|
| 7 | // Filesystem == /home/web/www.yourdomain.com |
---|
| 8 | $BASE_DIR = $GLOBALS[UploadImageBaseDir]; |
---|
| 9 | $BASE_URL = $GLOBALS[UploadImageBaseURL]; |
---|
| 10 | $BASE_ROOT = $GLOBALS[UploadImageRelativePath]; |
---|
| 11 | |
---|
| 12 | var_dump($BASE_DIR); |
---|
| 13 | var_dump($BASE_URL); |
---|
| 14 | var_dump($BASE_ROOT); |
---|
| 15 | |
---|
| 16 | //$BASE_DIR = $_SERVER['DOCUMENT_ROOT']; |
---|
| 17 | //$BASE_DIR = '/home/www'; |
---|
| 18 | |
---|
| 19 | //the path where the browser sees the document root (i.e. http://www.yourdomain.com/) |
---|
| 20 | //$BASE_URL = 'https://192.168.0.2/'; |
---|
| 21 | |
---|
| 22 | //this is where the images will be stored relative to the $BASE_DIR (and $BASE_URL) |
---|
| 23 | //this directory MUST be readable AND writable by the web server. |
---|
| 24 | //$BASE_ROOT = ''; |
---|
| 25 | |
---|
| 26 | //The image manipulation library to use, either GD or ImageMagick or NetPBM |
---|
| 27 | //valid definitions are 'GD' or 'IM' or 'NetPBM'. |
---|
| 28 | define('IMAGE_CLASS', 'GD'); // |
---|
| 29 | |
---|
| 30 | //After defining which library to use, if it is NetPBM or IM, you need to |
---|
| 31 | //specify where the binary for the selected library are. And of course |
---|
| 32 | //your server and PHP must be able to execute them (i.e. safe mode is OFF). |
---|
| 33 | //If you have safe mode ON, or don't have the binaries, your choice is |
---|
| 34 | //GD only. GD does not require the following definition. |
---|
| 35 | define('IMAGE_TRANSFORM_LIB_PATH', '/usr/bin/netpbm/'); |
---|
| 36 | //define('IMAGE_TRANSFORM_LIB_PATH', '"D:\\Program Files\\ImageMagick\\'); |
---|
| 37 | |
---|
| 38 | |
---|
| 39 | //In safe mode, directory creation is not permitted. |
---|
| 40 | $SAFE_MODE = false; |
---|
| 41 | |
---|
| 42 | //************************** END CONFIGURATION *****************************// |
---|
| 43 | |
---|
| 44 | $IMG_ROOT = $BASE_ROOT; |
---|
| 45 | |
---|
| 46 | if(strrpos($BASE_DIR, '/')!= strlen($BASE_DIR)-1) |
---|
| 47 | $BASE_DIR .= '/'; |
---|
| 48 | |
---|
| 49 | if(strrpos($BASE_URL, '/')!= strlen($BASE_URL)-1) |
---|
| 50 | $BASE_URL .= '/'; |
---|
| 51 | |
---|
| 52 | //Built in function of dirname is faulty |
---|
| 53 | //It assumes that the directory nane can not contain a . (period) |
---|
| 54 | function dir_name($dir) |
---|
| 55 | { |
---|
| 56 | $lastSlash = intval(strrpos($dir, '/')); |
---|
| 57 | if($lastSlash == strlen($dir)-1){ |
---|
| 58 | return substr($dir, 0, $lastSlash); |
---|
| 59 | } |
---|
| 60 | else |
---|
| 61 | return dirname($dir); |
---|
| 62 | } |
---|
| 63 | |
---|
| 64 | ?> |
---|