Rev Author Line No. Line
784 Dawon 1 <?php
786 Dawon 2 header("Content-type: image/jpeg");
784 Dawon 3  
4 function file_type($file){
5 $path_chunks = explode("/", $file);
6 $thefile = $path_chunks[count($path_chunks) - 1];
7 $dotpos = strrpos($thefile, ".");
8 return strtolower(substr($thefile, $dotpos + 1));
9 }
10  
11 $path = "/var/www/Modules/".$HTTP_GET_VARS["pth"]."/";
12 $filename = $HTTP_GET_VARS["fname"]."_Small.jpg";
13 // $thumbnail = thumbnail_name($filename);
14 $extension = file_type($filename);
15 $remove_thumb = false;
16  
17  
18 if(in_array($extension, array('png', 'gif', 'jpg', 'jpeg'))){
19 if(!$img_size = getimagesize($path.$filename)){
20 $remove_thumb = true;
21 }
22 if($extension == 'gif'){
23 if(!$image = imagecreatefromgif($path.$filename)){
24 $remove_thumb = true;
25 }
26 }elseif($extension == 'png'){
27 if(!$image = imagecreatefrompng($path.$filename)){
28 $remove_thumb = true;
29 }
30 }elseif($extension == 'jpg' || $extension == 'jpeg'){
31 if(!$image = imagecreatefromjpeg($path.$filename)){
32 $remove_thumb = true;
33 }
34 }
35 if($remove_thumb == false){
36  
37 $black = ImageColorAllocate($thumb, 0, 0, 0);
38 ImageString ($thumb, 3, $thumb_width-80, $thumb_height-15, "www.mlab.cz", $black);
39 imagejpeg($image);
40  
41 }
42 }else{
43 $remove_thumb = true;
44 }
45  
786 Dawon 46  
784 Dawon 47  
48 ?>