aboutsummaryrefslogtreecommitdiffstats
path: root/include/functions.inc.php
diff options
context:
space:
mode:
authorplegall <plg@piwigo.org>2004-11-16 23:38:34 +0000
committerplegall <plg@piwigo.org>2004-11-16 23:38:34 +0000
commit1bf3753f1449eedc4bd39c79b6ca17dc4f396e76 (patch)
tree7d7443b94356cd18a038b3f104f6e21a35d01279 /include/functions.inc.php
parent973e0f8806cd6d569c01977ad5112e16cc7a7f6f (diff)
- images.path column added to reduce database access
- function mass_inserts moved from admin/remote_sites.php to admin/include/function.php - function mass_inserts used in admin/update.php git-svn-id: http://piwigo.org/svn/trunk@606 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to 'include/functions.inc.php')
-rw-r--r--include/functions.inc.php35
1 files changed, 10 insertions, 25 deletions
diff --git a/include/functions.inc.php b/include/functions.inc.php
index 8903c28d5..860811c3c 100644
--- a/include/functions.inc.php
+++ b/include/functions.inc.php
@@ -570,47 +570,32 @@ function get_templates()
* returns thumbnail filepath (or distant URL if thumbnail is remote) for a
* given element
*
- * this function could have taken only the element id as parameter but to
- * optimize database access we directly ask file, storage category
- * identifier and extension since when this function is called,
- * PhpWebGallery should have all these infos. No need to retrieve them
- * another time in the database.
- *
* the returned string can represente the filepath of the thumbnail or the
* filepath to the corresponding icon for non picture elements
*
- * complete directories are cached to be used more than once during a page
- * generation (many thumbnails of the same category on the same page)
- *
- * @param string file
- * @param int storage_category_id
+ * @param string path
* @param string tn_ext
* @return string
*/
-function get_thumbnail_src($file, $storage_category_id, $tn_ext = '')
+function get_thumbnail_src($path, $tn_ext = '')
{
- global $conf, $user, $array_cat_directories;
-
- if (!isset($array_cat_directories[$storage_category_id]))
- {
- $array_cat_directories[$storage_category_id] =
- get_complete_dir($storage_category_id);
- }
-
+ global $conf, $user;
+
if ($tn_ext != '')
{
- $src = $array_cat_directories[$storage_category_id];
- $src.= 'thumbnail/'.$conf['prefix_thumbnail'];
- $src.= get_filename_wo_extension($file);
+ $src = substr_replace(get_filename_wo_extension($path),
+ '/thumbnail/'.$conf['prefix_thumbnail'],
+ strrpos($path,'/'),
+ 1);
$src.= '.'.$tn_ext;
}
else
{
$src = PHPWG_ROOT_PATH;
$src.= 'template/'.$user['template'].'/mimetypes/';
- $src.= strtolower(get_extension($file)).'.png';
+ $src.= strtolower(get_extension($path)).'.png';
}
-
+
return $src;
}
?>