added faster alternative for get image link
authorniekt0 <niekt0@kyberia.cz>
Mon, 4 Apr 2011 20:35:13 +0000 (22:35 +0200)
committerniekt0 <niekt0@kyberia.cz>
Mon, 4 Apr 2011 20:35:13 +0000 (22:35 +0200)
wwwroot/inc/smarty/node_methodz/function.get_image_link_fast.php [new file with mode: 0644]

diff --git a/wwwroot/inc/smarty/node_methodz/function.get_image_link_fast.php b/wwwroot/inc/smarty/node_methodz/function.get_image_link_fast.php
new file mode 100644 (file)
index 0000000..d106916
--- /dev/null
@@ -0,0 +1,15 @@
+<?php
+// Faster alternative for geting user image link 
+// (no db connection)
+// this is fine for example for viewing "K", much less db requests.
+
+function smarty_function_get_image_link_fast($params,&$smarty) {
+       $id = $params['id'];
+       
+       if (!is_numeric($id)) { $id=0;}
+       $img = './'.SYSTEM_IMAGES.'/nodes/'.substr($id,0,1)."/".substr($id,1,1)."/$id.gif";
+
+       if (file_exists($img)) { echo "$img"; } 
+       else { echo SYSTEM_IMAGES.'/nodes///.gif'; }
+}
+?>
This page took 0.201907 seconds and 4 git commands to generate.