C:\$Recycle.Bin\S-1-5-21-3967099092-2644009230-141905953-500\$RVSVKU0\setup\cpg1419\showthumb.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2008 Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License version 3
  as published by the Free Software Foundation.
  
  ********************************************
  Coppermine version: 1.4.19
  $HeadURL: https://coppermine.svn.sourceforge.net/svnroot/coppermine/trunk/cpg1.4.x/showthumb.php $
  $Revision: 4392 $
  $Author: gaugau $
  $Date: 2008-04-16 09:25:35 +0200 (Mi, 16 Apr 2008) $
**********************************************/

define('IN_COPPERMINE'true);
define('SHOWTHUMB_PHP'true);

require(
"include/init.inc.php");

if (!
GALLERY_ADMIN_MODEcpg_die(ERROR$lang_errors['access_denied'], __FILE____LINE__);

define("GIS_GIF"1);
define("GIS_JPG"2);
define("GIS_PNG"3);

define("UNKNOW_ICON"'images/unk48x48.gif');
define("GIF_ICON"'images/gif48x48.gif');
define("READ_ERROR_ICON"'images/read_error48x48.gif');

function 
makethumbnail($src_file$newSize$method)
{
    global 
$CONFIG;

    
$content_type = array(
        
GIS_GIF => 'gif',
        
GIS_JPG => 'jpeg',
        
GIS_PNG => 'png'
        
);
    
// Checks that file exists and is readable
    
if (!filesize($src_file) || !is_readable($src_file)) {
        
header("Content-type: image/gif");
        
fpassthru(fopen(READ_ERROR_ICON'rb'));
        exit;
    }
    
// find the image size, no size => unknow type
    
$imginfo getimagesize($src_file);
    if (
$imginfo == null) {
        
header("Content-type: image/gif");
        
fpassthru(fopen(UNKNOW_ICON'rb'));
        exit;
    }
    
// GD can't handle gif images
    //if ($imginfo[2] == GIS_GIF && ($method == 'gd1' || $method == 'gd2')) {
    
if ($imginfo[2] == GIS_GIF && $CONFIG['GIF_support'] == 0) {
        
header("Content-type: image/gif");
        
fpassthru(fopen(GIF_ICON'rb'));
        exit;
    }
    
// height/width
    
$srcWidth $imginfo[0];
    
$srcHeight $imginfo[1];

    
$ratio max($srcWidth$srcHeight) / $newSize;
    
$ratio max($ratio1.0);
    
$destWidth = (int)($srcWidth $ratio);
    
$destHeight = (int)($srcHeight $ratio);
    
// Choose method for thumb creation
    
switch ($method) {
        case 
"im" :
            if (
preg_match("#[A-Z]:|\\\\#Ai"__FILE__)) {
                
$cur_dir dirname(__FILE__);
                
$src_file '"' $cur_dir '\\' strtr($src_file'/''\\') . '"';
            } else {
                
$src_file escapeshellarg($src_file);
            }
            
header("Content-type: image/" . ($content_type[$imginfo[2]]));
            
passthru("{$CONFIG['impath']}convert -quality $CONFIG[jpeg_qual] -antialias -geometry {$destWidth}x{$destHeight} $src_file -");
            break;

        case 
"gd2" :
            if (
$imginfo[2] == GIS_GIF && $CONFIG['GIF_support'] == 1)
                
$src_img imagecreatefromgif($src_file);
            elseif (
$imginfo[2] == GIS_JPG)
                
$src_img imagecreatefromjpeg($src_file);
            else
                
$src_img imagecreatefrompng($src_file);
            if (
$imginfo[2] == GIS_GIF)
              
$dst_img imagecreate($destWidth$destHeight);
            else
              
$dst_img imagecreatetruecolor($destWidth$destHeight);
            
imagecopyresampled($dst_img$src_img0000$destWidth, (int)$destHeight$srcWidth$srcHeight);
            
header("Content-type: image/jpeg");
            
imagejpeg($dst_img);
            
imagedestroy($src_img);
            
imagedestroy($dst_img);
            break;

        default :
            if (
$imginfo[2] == GIS_JPG)
                
$src_img imagecreatefromjpeg($src_file);
            else
                
$src_img imagecreatefrompng($src_file);
            
$dst_img imagecreate($destWidth$destHeight);
            
imagecopyresized($dst_img$src_img0000$destWidth, (int)$destHeight$srcWidth$srcHeight);
            
header("Content-type: image/jpeg");
            
imagejpeg($dst_img);
            
imagedestroy($src_img);
            
imagedestroy($dst_img);
            break;
    }
}

makethumbnail($CONFIG['fullpath'] . $_GET['picfile'], $_GET['size'], $CONFIG['thumb_method']);

?>