Line 1... |
Line 1... |
1 |
<?php |
1 |
<?php |
2 |
|
- |
|
- |
|
2 |
header("Content-type: image/jpeg"); |
3 |
function file_type($file){ |
3 |
function file_type($file){ |
4 |
$path_chunks = explode("/", $file); |
4 |
$path_chunks = explode("/", $file); |
5 |
$thefile = $path_chunks[count($path_chunks) - 1]; |
5 |
$thefile = $path_chunks[count($path_chunks) - 1]; |
6 |
$dotpos = strrpos($thefile, "."); |
6 |
$dotpos = strrpos($thefile, "."); |
7 |
return strtolower(substr($thefile, $dotpos + 1)); |
7 |
return strtolower(substr($thefile, $dotpos + 1)); |
Line 20... |
Line 20... |
20 |
$remove_thumb = false; |
20 |
$remove_thumb = false; |
21 |
$img_size = array(); |
21 |
$img_size = array(); |
22 |
$width = "150"; |
22 |
$width = "150"; |
23 |
$height = "150"; |
23 |
$height = "150"; |
24 |
|
24 |
|
25 |
if (!file_exists("/tmp/".$filename)) { |
25 |
// if (!file_exists("/tmp/".$filename)) { |
26 |
|
26 |
|
27 |
if(in_array($extension, array('png', 'gif', 'jpg', 'jpeg'))){ |
27 |
if(in_array($extension, array('png', 'gif', 'jpg', 'jpeg'))){ |
28 |
if(!$img_size = getimagesize($path.$filename)){ |
28 |
if(!$img_size = getimagesize($path.$filename)){ |
29 |
$remove_thumb = true; |
29 |
$remove_thumb = true; |
30 |
} |
30 |
} |
Line 55... |
Line 55... |
55 |
} |
55 |
} |
56 |
if($remove_thumb == false){ |
56 |
if($remove_thumb == false){ |
57 |
$thumb = imagecreatetruecolor($thumb_width, $thumb_height); |
57 |
$thumb = imagecreatetruecolor($thumb_width, $thumb_height); |
58 |
imagecopyresampled($thumb, $image, 0, 0, 0, 0, $thumb_width, $thumb_height, $img_size[0], $img_size[1] ); |
58 |
imagecopyresampled($thumb, $image, 0, 0, 0, 0, $thumb_width, $thumb_height, $img_size[0], $img_size[1] ); |
59 |
$black = ImageColorAllocate($thumb, 0, 0, 0); |
59 |
$black = ImageColorAllocate($thumb, 0, 0, 0); |
60 |
ImageString ($thumb, 3, $thumb_width-90, $thumb_height-15, "www.mlab.cz", $black); |
60 |
ImageString ($thumb, 3, $thumb_width-80, $thumb_height-15, "www.mlab.cz", $black); |
61 |
imagejpeg($thumb, "/tmp/".$filename); |
61 |
imagejpeg($thumb/*, "/tmp/".$filename*/); |
62 |
|
62 |
|
63 |
} |
63 |
} |
64 |
}else{ |
64 |
}else{ |
65 |
$remove_thumb = true; |
65 |
$remove_thumb = true; |
66 |
} |
66 |
} |
67 |
|
67 |
|
68 |
} |
68 |
// } |
69 |
|
69 |
|
70 |
|
70 |
|
71 |
header("Content-type: image/jpeg"); |
- |
|
- |
|
71 |
|
72 |
readfile("/tmp/".$filename); |
72 |
//readfile("/tmp/".$filename); |
73 |
?> |
73 |
?> |