Added define SYSTEM_IMAGES and using it to generate image URLs
authorHarvie <tomas@mudrunka.cz>
Fri, 17 Dec 2010 12:29:57 +0000 (13:29 +0100)
committerHarvie <tomas@mudrunka.cz>
Fri, 17 Dec 2010 12:29:57 +0000 (13:29 +0100)
wwwroot/config/config_default.inc
wwwroot/inc/eventz/configure.inc
wwwroot/inc/eventz/configure_image.inc
wwwroot/inc/eventz/upload_data_file.inc
wwwroot/inc/smarty/node_methodz/function.get_image_link.php

index 96e1021f2271d80a6152e26b29df882b65cafdfc..98cea28ef468e84061eb68f30dc8da5889f417f6 100644 (file)
@@ -11,6 +11,7 @@ date_default_timezone_set('Europe/Prague');
 
 define('SYSTEM_ROOT',          '/srv/kyberia/');
 define('SYSTEM_DATA',          SYSTEM_ROOT . '/wwwroot/_data/');
+define('SYSTEM_IMAGES',                '/_images/');
 define('CONFIG_DIR',           SYSTEM_ROOT . 'config/');
 define('AJAX_DIR',             SYSTEM_ROOT . 'wwwroot/ajax/');
 define('INCLUDE_DIR',          SYSTEM_ROOT . 'wwwroot/inc/');
index 756abc239fc3c0d778463461276bf77e40c70f46..8479152c035019886102c12cc4846f19b4a1679e 100644 (file)
                        else $width=123;
 
                        if (stristr($image_name,".jpg") || stristr($image_name,".jpeg") ){
-                               $cmd=UTILZ_DIR."/jpegtopnm  $image |".UTILZ_DIR."/pnmscale -width=$width | ".UTILZ_DIR."ppmquant 256 |".UTILZ_DIR."ppmtogif >".SYSTEM_ROOT."images/nodes/".substr($node['node_id'],0,1)."/".substr($node['node_id'],1,1)."/".$node['node_id'].".gif";
+                               $cmd=UTILZ_DIR."/jpegtopnm  $image |".UTILZ_DIR."/pnmscale -width=$width | ".UTILZ_DIR."ppmquant 256 |".UTILZ_DIR."ppmtogif >".SYSTEM_ROOT.SYSTEM_IMAGES.'/nodes/'.substr($node['node_id'],0,1)."/".substr($node['node_id'],1,1)."/".$node['node_id'].".gif";
                        }
                        elseif (stristr($image_name,".gif")) {
-                               $cmd=UTILZ_DIR."/gifsicle --resize ".$width."x_ $image > ".SYSTEM_ROOT."images/nodes/".substr($node['node_id'],0,1)."/".substr($node['node_id'],1,1)."/".$node['node_id'].".gif";
+                               $cmd=UTILZ_DIR."/gifsicle --resize ".$width."x_ $image > ".SYSTEM_ROOT.SYSTEM_IMAGES.'/nodes/'.substr($node['node_id'],0,1)."/".substr($node['node_id'],1,1)."/".$node['node_id'].".gif";
                        }
                        if ($cmd) {
                                shell_exec($cmd);
index 4ac3d005988295740353ce59c01bc732b266a25b..4e4bc5db714411b25cae032b55ca35ec50d0ae0f 100644 (file)
@@ -67,7 +67,7 @@
 
             $_required_dims    = ($node['node_id'] == $_SESSION['user_id'])?50:NODE_IMAGE_WIDTH;
             $_prepared_fname   = sprintf('%s/prepared/%03s_%s.gif.upload', $_PROCESS_IMG_PATH, $_required_dims, $node['node_id']);
-            $_nodeimg_fname    = sprintf('%s/images/nodes/%s/%s/%d.gif', $_WEBROOT_PATH, $node['node_id'][0], $node['node_id'][1], $node['node_id']);
+            $_nodeimg_fname    = sprintf('%s/'.SYSTEM_IMAGES.'/nodes/%s/%s/%d.gif', $_WEBROOT_PATH, $node['node_id'][0], $node['node_id'][1], $node['node_id']);
 
             if (!is_uploaded_file($_FILES['description_image']['tmp_name'])) {
                 $error = '#02: Invalid file upload';
index 070d7581127043fa0e9ce0a56b13a2252cc6dfeb..09aa33eae3bd99a0393b970edbb25205f79ca487 100644 (file)
@@ -70,10 +70,10 @@ function upload_data_file() {
                                            stristr($image_name,".jpeg") ){
                                                
                                                /// XXX UTILZ_DIR is not set. remove?
-                                               $cmd=UTILZ_DIR."/jpegtopnm  $image |".UTILZ_DIR."/pnmscale -width=$width | ".UTILZ_DIR."ppmquant 256 |".UTILZ_DIR."ppmtogif >".SYSTEM_ROOT."images/nodes/".substr($datanode_id,0,1)."/".substr($datanode_id,1,1)."/".$datanode_id.".gif";
+                                               $cmd=UTILZ_DIR."/jpegtopnm  $image |".UTILZ_DIR."/pnmscale -width=$width | ".UTILZ_DIR."ppmquant 256 |".UTILZ_DIR."ppmtogif >".SYSTEM_ROOT.SYSTEM_IMAGES.'/nodes/'.substr($datanode_id,0,1)."/".substr($datanode_id,1,1)."/".$datanode_id.".gif";
                                        }
                                        elseif (stristr($image_name,".gif")) {
-                                               $cmd=UTILZ_DIR."/gifsicle --resize ".$width."x_ $image > ".SYSTEM_ROOT."images/nodes/".substr($datanode_id,0,1)."/".substr($datanode_id,1,1)."/".$datanode_id.".gif";
+                                               $cmd=UTILZ_DIR."/gifsicle --resize ".$width."x_ $image > ".SYSTE_ROOT.SYSTEM_IMAGES.'/nodes/'.substr($datanode_id,0,1)."/".substr($datanode_id,1,1)."/".$datanode_id.".gif";
                                        }
                                        if ($cmd) {
                                                shell_exec($cmd);
index fe9a891aeccacd29a943bb8338e41b57183e24c5..606e3d3facce13a45331e1bb5acc04ba29bc8a64 100644 (file)
@@ -2,17 +2,17 @@
 function smarty_function_get_image_link($params,&$smarty) {
        global $db;
        $id = $params['id'];
-       $img = SYSTEM_DATA."/images/nodes/".substr($id,0,1)."/".substr($id,1,1)."/$id.gif";
+       $img = SYSTEM_DATA.SYSTEM_IMAGES.'/nodes/'.substr($id,0,1)."/".substr($id,1,1)."/$id.gif";
 
        if (file_exists($img)) {
-               echo "/images/nodes/".substr($id,0,1)."/".substr($id,1,1)."/$id.gif";
+               echo SYSTEM_IMAGES.'/nodes/'.substr($id,0,1)."/".substr($id,1,1)."/$id.gif";
        }
        else {
                $set = $db->query("select user_id from users where user_id = $id");
                if ($set->getNumRows() > 0) {
-                       $imglink = "/images/nodes///.gif";
+                       $imglink = SYSTEM_IMAGES.'/nodes///.gif';
                } else {
-                       $imglink = "/images/nodes/1/0/101.gif";
+                       $imglink = SYSTEM_IMAGES.'/nodes/1/0/101.gif';
                }
                echo $imglink;
        }
This page took 0.208434 seconds and 4 git commands to generate.