mirror of
https://github.com/jimeh/dlist.git
synced 2026-02-19 07:56:41 +00:00
- thumbnail support is fully functional with custom imageThumb class which supports caching and so on, the class is still considered beta (specially the clean_cache() function)
- updated simple template - added Last Access (atime) to dirlist.lib.php - updated and fixed loads of other things git-svn-id: file:///Users/jimeh/Desktop/dlist/trunk@18 a5845835-ea0f-0410-a762-dd0bfe9bfde8
This commit is contained in:
@@ -23,18 +23,20 @@ Author: Jim Myhrberg
|
||||
class Icon {
|
||||
|
||||
//>Section> get_url
|
||||
function get_url ($ext, $size, $type) {
|
||||
//TODO enable thumbnail support using phpThumbs
|
||||
function get_url ($file, $size, $type, $thumbnail=false) {
|
||||
global $config;
|
||||
if ( $size == 'large' || $size == 'big' ) {
|
||||
$size = $config->icons_large;
|
||||
} else {
|
||||
$size = $config->icons_small;
|
||||
}
|
||||
$ext = ( preg_match("/.*\.(.*)/", $file, $ext) ) ? $ext[1] : '' ;
|
||||
$icons_path = ICONS_PATH.$size.'/';
|
||||
$icons_url = ICONS_URL.$size.'/';
|
||||
if ( $type == 'file' ) {
|
||||
if ( file_exists($icons_path.$ext.$config->icons_ext) ) {
|
||||
if ( preg_match("/jpg|jpeg|png/", $ext) && $thumbnail ) {
|
||||
return DLIST_URL.'thumb.php?src='.urlencode(DIR_URL.$file).'&w=48&h=48';
|
||||
} elseif ( file_exists($icons_path.$ext.$config->icons_ext) ) {
|
||||
return $icons_url.$ext.$config->icons_ext;
|
||||
} else {
|
||||
return $icons_url.'_file'.$config->icons_ext;
|
||||
@@ -58,6 +60,16 @@ class Icon {
|
||||
}
|
||||
return ICONS_URL.$size.'/_parent'.$config->icons_ext;
|
||||
}
|
||||
|
||||
//>Section> is_image
|
||||
function is_image ($file) {
|
||||
if ( preg_match("/.*\.(jpg|jpeg|png|gif|bmp)/", $file) ) {
|
||||
return true;
|
||||
} elseif ( preg_match("/jpg|jpeg|png|gif|bmp/", $file) ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
//> class.end
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user