Ignore:
Timestamp:
Nov 17, 2004, 12:38:34 AM (19 years ago)
Author:
plg
Message:
  • 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
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/include/functions.inc.php

    r599 r606  
    571571 * given element
    572572 *
    573  * this function could have taken only the element id as parameter but to
    574  * optimize database access we directly ask file, storage category
    575  * identifier and extension since when this function is called,
    576  * PhpWebGallery should have all these infos. No need to retrieve them
    577  * another time in the database.
    578  *
    579573 * the returned string can represente the filepath of the thumbnail or the
    580574 * filepath to the corresponding icon for non picture elements
    581575 *
    582  * complete directories are cached to be used more than once during a page
    583  * generation (many thumbnails of the same category on the same page)
    584  *
    585  * @param string file
    586  * @param int storage_category_id
     576 * @param string path
    587577 * @param string tn_ext
    588578 * @return string
    589579 */
    590 function get_thumbnail_src($file, $storage_category_id, $tn_ext = '')
    591 {
    592   global $conf, $user, $array_cat_directories;
    593  
    594   if (!isset($array_cat_directories[$storage_category_id]))
    595   {
    596     $array_cat_directories[$storage_category_id] =
    597       get_complete_dir($storage_category_id);
    598   }
    599  
     580function get_thumbnail_src($path, $tn_ext = '')
     581{
     582  global $conf, $user;
     583
    600584  if ($tn_ext != '')
    601585  {
    602     $src = $array_cat_directories[$storage_category_id];
    603     $src.= 'thumbnail/'.$conf['prefix_thumbnail'];
    604     $src.= get_filename_wo_extension($file);
     586    $src = substr_replace(get_filename_wo_extension($path),
     587                          '/thumbnail/'.$conf['prefix_thumbnail'],
     588                          strrpos($path,'/'),
     589                          1);
    605590    $src.= '.'.$tn_ext;
    606591  }
     
    609594    $src = PHPWG_ROOT_PATH;
    610595    $src.= 'template/'.$user['template'].'/mimetypes/';
    611     $src.= strtolower(get_extension($file)).'.png';
    612   }
    613 
     596    $src.= strtolower(get_extension($path)).'.png';
     597  }
     598 
    614599  return $src;
    615600}
Note: See TracChangeset for help on using the changeset viewer.