|
Revision 579, 2.2 kB
(checked in by ray, 7 years ago)
|
|
ExtendedFileManager updates:
*to complete cofigurability through js directories can now be set for images and files individually (optional & backwards compatible)
* linkfile button can be disabled (xinha_config.ExtendedFileManager.use_linker =false)
* relocated button from the end of toolbar next to createlink
* insert image/link with double click
* preview img didn't have src when no image selected, which showed a "image not found icon" in IE
* slight modifications and updates in Readme.txt (kicked out afru's website. The domain isn't even registered anymore)
|
| Line | |
|---|
| 1 | <?php |
|---|
| 2 | |
|---|
| 3 | |
|---|
| 4 | |
|---|
| 5 | |
|---|
| 6 | |
|---|
| 7 | |
|---|
| 8 | |
|---|
| 9 | |
|---|
| 10 | |
|---|
| 11 | |
|---|
| 12 | if(isset($_REQUEST['mode'])) $insertMode=$_REQUEST['mode']; |
|---|
| 13 | if(!isset($insertMode)) $insertMode="image"; |
|---|
| 14 | |
|---|
| 15 | require_once('config.inc.php'); |
|---|
| 16 | require_once('Classes/ExtendedFileManager.php'); |
|---|
| 17 | require_once('../ImageManager/Classes/Thumbnail.php'); |
|---|
| 18 | |
|---|
| 19 | |
|---|
| 20 | if(!isset($_GET['img'])) |
|---|
| 21 | exit(); |
|---|
| 22 | |
|---|
| 23 | $manager = new ExtendedFileManager($IMConfig,$insertMode); |
|---|
| 24 | |
|---|
| 25 | |
|---|
| 26 | $image = rawurldecode($_GET['img']); |
|---|
| 27 | $fullpath = Files::makeFile($manager->getImagesDir(),$image); |
|---|
| 28 | |
|---|
| 29 | |
|---|
| 30 | if(!is_file($fullpath)) |
|---|
| 31 | exit(); |
|---|
| 32 | |
|---|
| 33 | $imgInfo = @getImageSize($fullpath); |
|---|
| 34 | |
|---|
| 35 | |
|---|
| 36 | if(!is_array($imgInfo)) |
|---|
| 37 | { |
|---|
| 38 | |
|---|
| 39 | $default = $manager->getDefaultThumb(); |
|---|
| 40 | if($default) |
|---|
| 41 | { |
|---|
| 42 | header('Location: '.$default); |
|---|
| 43 | exit(); |
|---|
| 44 | } |
|---|
| 45 | } |
|---|
| 46 | |
|---|
| 47 | |
|---|
| 48 | if ($imgInfo[0] <= $IMConfig['thumbnail_width'] |
|---|
| 49 | && $imgInfo[1] <= $IMConfig['thumbnail_height']) |
|---|
| 50 | { |
|---|
| 51 | header('Location: '.$manager->getFileURL($image)); |
|---|
| 52 | exit(); |
|---|
| 53 | } |
|---|
| 54 | |
|---|
| 55 | |
|---|
| 56 | $thumbnail = $manager->getThumbName($fullpath); |
|---|
| 57 | if(is_file($thumbnail)) |
|---|
| 58 | { |
|---|
| 59 | |
|---|
| 60 | if(filemtime($thumbnail) >= filemtime($fullpath)) |
|---|
| 61 | { |
|---|
| 62 | header('Location: '.$manager->getThumbURL($image)); |
|---|
| 63 | exit(); |
|---|
| 64 | } |
|---|
| 65 | } |
|---|
| 66 | |
|---|
| 67 | |
|---|
| 68 | $thumbnailer = new Thumbnail($IMConfig['thumbnail_width'],$IMConfig['thumbnail_height']); |
|---|
| 69 | $thumbnailer->createThumbnail($fullpath, $thumbnail); |
|---|
| 70 | |
|---|
| 71 | |
|---|
| 72 | if(is_file($thumbnail)) |
|---|
| 73 | { |
|---|
| 74 | |
|---|
| 75 | header('Location: '.$manager->getThumbURL($image)); |
|---|
| 76 | exit(); |
|---|
| 77 | } |
|---|
| 78 | else |
|---|
| 79 | { |
|---|
| 80 | |
|---|
| 81 | $default = $manager->getDefaultThumb(); |
|---|
| 82 | if($default) |
|---|
| 83 | header('Location: '.$default); |
|---|
| 84 | } |
|---|
| 85 | ?> |
|---|