mirror of
https://github.com/jimeh/dlist.git
synced 2026-02-19 07:56:41 +00:00
Incorporated an OSS license:
The GNU General Public License (GPL) Version 2, June 1991 git-svn-id: file:///Users/jimeh/Desktop/dlist/trunk@24 a5845835-ea0f-0410-a762-dd0bfe9bfde8
This commit is contained in:
@@ -1,11 +1,31 @@
|
||||
<?php die();
|
||||
|
||||
//
|
||||
// Exec: icons
|
||||
//
|
||||
// Copyright © 2006 Jim Myhrberg. All rights reserved.
|
||||
// zynode@gmail.com
|
||||
//
|
||||
/*
|
||||
|
||||
Exec: icons
|
||||
|
||||
Copyright © 2006 Jim Myhrberg.
|
||||
zynode@gmail.com
|
||||
|
||||
----------
|
||||
This program is free software; you can redistributeit and/or modify it
|
||||
under the terms of the GNU General Public License as published by the Free
|
||||
Software Foundation; either version 2 of the License, or (at your option)
|
||||
any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write to the Free Software Foundation, Inc., 59
|
||||
Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
----------
|
||||
|
||||
*/
|
||||
|
||||
|
||||
|
||||
//_HEAD;
|
||||
/* --- Configuration ---
|
||||
@@ -27,6 +47,8 @@ class Icon {
|
||||
global $config;
|
||||
if ( $size == 'large' || $size == 'big' ) {
|
||||
$size = $config->icons_large;
|
||||
$sizew = $config->icons_large_w;
|
||||
$sizeh = $config->icons_large_h;
|
||||
} else {
|
||||
$size = $config->icons_small;
|
||||
}
|
||||
@@ -34,8 +56,8 @@ class Icon {
|
||||
$icons_path = ICONS_PATH.$size.'/';
|
||||
$icons_url = ICONS_URL.$size.'/';
|
||||
if ( $type == 'file' ) {
|
||||
if ( preg_match("/jpg|jpeg|jpe|png/i", $ext) && $thumbnail && $config->thumbnails ) {
|
||||
return DLIST_URL.'thumb.php?src='.rawurlencode(DIR_URL.$file).'&w=48&h=48';
|
||||
if ( preg_match($config->thumb_pattern, $ext) && $thumbnail && $config->thumbnails ) {
|
||||
return DLIST_URL.'thumb.php?src='.rawurlencode(DIR_URL.$file).'&w='.$sizew.'&h='.$sizeh;
|
||||
} elseif ( file_exists($icons_path.$ext.$config->icons_ext) ) {
|
||||
return $icons_url.$ext.$config->icons_ext;
|
||||
} else {
|
||||
@@ -50,6 +72,11 @@ class Icon {
|
||||
}
|
||||
}
|
||||
|
||||
//>Section> get_thumbnail
|
||||
function get_thumbnail_url ($file, $sizew, $sizeh) {
|
||||
return DLIST_URL.'thumb.php?src='.rawurlencode(DIR_URL.$file).'&w='.$sizew.'&h='.$sizeh;
|
||||
}
|
||||
|
||||
//>Section> get_parent
|
||||
function get_parent ($size) {
|
||||
global $config;
|
||||
@@ -63,12 +90,9 @@ class Icon {
|
||||
|
||||
//>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;
|
||||
global $config;
|
||||
if ( preg_match($config->thumb_pattern, $file) ) return true;
|
||||
else return false;
|
||||
}
|
||||
//> class.end
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user