Changeset 862 for trunk/admin/include
- Timestamp:
- Sep 14, 2005, 11:57:05 PM (19 years ago)
- Location:
- trunk/admin/include
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/admin/include/functions.php
r858 r862 28 28 include(PHPWG_ROOT_PATH.'admin/include/functions_metadata.php'); 29 29 30 $tab_ext_create_TN = array ( 'jpg', 'png', 'JPG', 'PNG' );31 32 // is_image returns true if the given $filename (including the path) is a33 // picture according to its format and its extension.34 // As GD library can only generate pictures from jpeg and png files, if you35 // ask if the filename is an image for thumbnail creation (second parameter36 // set to true), the only authorized formats are jpeg and png.37 function is_image( $filename, $create_thumbnail = false )38 {39 global $conf, $tab_ext_create_TN;40 41 if (is_file($filename)42 and in_array(get_extension($filename), $conf['picture_ext']))43 {44 $size = getimagesize( $filename );45 // $size[2] == 1 means GIF46 // $size[2] == 2 means JPG47 // $size[2] == 3 means PNG48 if ( !$create_thumbnail )49 {50 if ( in_array( get_extension( $filename ), $conf['picture_ext'] )51 and ( $size[2] == 1 or $size[2] == 2 or $size[2] == 3 ) )52 {53 return true;54 }55 }56 else57 {58 if ( in_array( get_extension( $filename ), $tab_ext_create_TN )59 and ( $size[2] == 2 or $size[2] == 3 ) )60 {61 return true;62 }63 }64 }65 return false;66 }67 68 30 /** 69 31 * returns an array with all picture files according to $conf['file_ext'] … … 142 104 return $pictures; 143 105 } 144 145 function TN_exists( $dir, $file )146 {147 global $conf;148 149 $filename = get_filename_wo_extension( $file );150 foreach ( $conf['picture_ext'] as $ext ) {151 $test = $dir.'/thumbnail/'.$conf['prefix_thumbnail'].$filename.'.'.$ext;152 if ( is_file ( $test ) )153 {154 return $ext;155 }156 }157 return false;158 }159 160 106 161 107 // The function delete_site deletes a site and call the function … … 553 499 } 554 500 555 function check_date_format( $date )556 {557 // date arrives at this format : DD/MM/YYYY558 @list($day,$month,$year) = explode( '/', $date );559 return @checkdate( $month, $day, $year );560 }561 562 function date_convert( $date )563 {564 // date arrives at this format : DD/MM/YYYY565 // It must be transformed in YYYY-MM-DD566 list($day,$month,$year) = explode( '/', $date );567 return $year.'-'.$month.'-'.$day;568 }569 570 501 function date_convert_back( $date ) 571 502 { … … 600 531 ) 601 532 ); 602 }603 604 /**605 * returns an array containing sub-directories which can be a category606 *607 * directories nammed "thumbnail", "pwg_high" or "pwg_representative" are608 * omitted609 *610 * @param string $basedir611 * @return array612 */613 function get_category_directories( $basedir )614 {615 $sub_dirs = array();616 617 if ( $opendir = opendir( $basedir ) )618 {619 while ( $file = readdir( $opendir ) )620 {621 if ($file != '.'622 and $file != '..'623 and $file != 'thumbnail'624 and $file != 'pwg_high'625 and $file != 'pwg_representative'626 and is_dir($basedir.'/'.$file))627 {628 array_push( $sub_dirs, $file );629 }630 }631 }632 return $sub_dirs;633 533 } 634 534 -
trunk/admin/include/functions_metadata.php
r858 r862 222 222 return $files; 223 223 } 224 225 // used_metadata string is displayed to inform admin which metadata will be226 // used from files for synchronization227 function get_used_metadata_list()228 {229 global $conf;230 231 $used_metadata = array('filesize', 'width', 'height');232 233 if ($conf['use_exif'])234 {235 array_push($used_metadata, 'date_creation');236 }237 238 if ($conf['use_iptc'])239 {240 foreach (array_keys($conf['use_iptc_mapping']) as $key)241 {242 array_push($used_metadata, $key);243 }244 }245 246 return array_unique($used_metadata);247 }248 224 ?>
Note: See TracChangeset
for help on using the changeset viewer.