[ Index ] |
|
Code source de eGroupWare 1.2.106-2 |
1 <?php 2 /**************************************************************************\ 3 * eGroupWare - Insert File Dialog, File Manager -plugin for tinymce * 4 * http://www.eGroupWare.org * 5 * Authors Al Rashid <alrashid@klokan.sk> * 6 * and Xiang Wei ZHUO <wei@zhuo.org> * 7 * Modified for eGW by Cornelius Weiss <egw@von-und-zu-weiss.de> * 8 * -------------------------------------------- * 9 * This program is free software; you can redistribute it and/or modify it * 10 * under the terms of the GNU General Public License as published by the * 11 * Free Software Foundation; version 2 of the License. * 12 * * 13 * Functions * 14 * - if the thumbnail does not exists or the source file is newer, create a * 15 * new thumbnail. * 16 \**************************************************************************/ 17 18 /* $id */ 19 20 require_once 'config.inc.php'; 21 require_once 'functions.php'; 22 require_once 'Transform.php'; 23 24 $img = $BASE_DIR.urldecode($_GET['img']); 25 26 if(is_file($img)) { 27 make_thumbs(urldecode($_GET['img'])); 28 } 29 30 function make_thumbs($img) 31 { 32 global $BASE_DIR, $BASE_URL; 33 34 $path_info = pathinfo($img); 35 $path = $path_info['dirname']."/"; 36 $img_file = $path_info['basename']; 37 38 $thumb = $path.'.'.$img_file; 39 40 $img_info = getimagesize($BASE_DIR.$path.$img_file); 41 $w = $img_info[0]; $h = $img_info[1]; 42 43 $nw = 96; $nh = 96; 44 45 if($w <= $nw && $h <= $nh) { 46 header('Location: '.$BASE_URL.$path.$img_file); 47 exit(); 48 } 49 50 if(is_file($BASE_DIR.$thumb)) { 51 52 $t_mtime = filemtime($BASE_DIR.$thumb); 53 $o_mtime = filemtime($BASE_DIR.$img); 54 55 if($t_mtime > $o_mtime) { 56 //echo $BASE_URL.$path.'.'.$img_file; 57 header('Location: '.$BASE_URL.$path.'.'.$img_file); 58 exit(); 59 } 60 } 61 62 $img_thumbs = Image_Transform::factory(IMAGE_CLASS); 63 $img_thumbs->load($BASE_DIR.$path.$img_file); 64 65 if ($w > $h) 66 $nh = unpercent(percent($nw, $w), $h); 67 else if ($h > $w) 68 $nw = unpercent(percent($nh, $h), $w); 69 70 $img_thumbs->resize($nw, $nh); 71 72 $img_thumbs->save($BASE_DIR.$thumb); 73 $img_thumbs->free(); 74 75 chmod($BASE_DIR.$thumb, 0666); 76 77 if(is_file($BASE_DIR.$thumb)) { 78 header('Location: '.$BASE_URL.$path.'.'.$img_file); 79 exit(); 80 } 81 } 82 83 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sun Feb 25 17:20:01 2007 | par Balluche grâce à PHPXref 0.7 |