/Web/modules.inc.php
7,10 → 7,12
 
 
 
if (file_exists($path.$folder.'/'.$HTTP_GET_VARS["file"]."/".$soubor1."/".$img)) {
/* if (file_exists($path.$folder.'/'.$HTTP_GET_VARS["file"]."/".$soubor1."/".$img)) {
echo "<td><img src=\"".$www.$folder.'/'.$HTTP_GET_VARS["file"]."/".$soubor1."/".$img."\"></td>\n";
} else { echo "<td><img src=\"http://www.mlab.cz/Web/PIC/nopicture2.jpg\"></td>\n"; }
} else { echo "<td><img src=\"http://www.mlab.cz/Web/PIC/nopicture2.jpg\"></td>\n"; }*/
 
echo "<td><img src=\"thumb.php?pth=".$soubor."/".$soubor1."&fname=".$soubor1."\"></td>\n";
 
if (file_exists($path.$folder."/".$HTTP_GET_VARS["file"]."/".$soubor1."/DOC/HTML/".$soubor1.".".$lang.".html")) {
echo "<td><a href=\"".$www.$folder."/".$HTTP_GET_VARS["file"]."/".$soubor1."/DOC/HTML/".$soubor1.".".$lang.".html\">".$soubor1."</a></td>\n";
} else { echo "<td>".$soubor."/<b>".$soubor1."</b></td>\n"; }
/Web/modules.php
117,8 → 117,9
 
if (file_exists($path.$folder."/".$soubor."/CAM_AMA")) {
echo "<tr>";
if (file_exists($path.$folder.'/'.$soubor."/".$img)) { echo "<td><img src=\"".$www.$folder.'/'.$soubor."/".$img."\"></td>\n"; }
else { echo "<td><img src=\"http://www.mlab.cz/Web/PIC/nopicture2.jpg\"></td>\n"; }
/* if (file_exists($path.$folder.'/'.$soubor."/".$img)) { echo "<td><img src=\"".$www.$folder.'/'.$soubor."/".$img."\"></td>\n"; }
else { echo "<td><img src=\"http://www.mlab.cz/Web/PIC/nopicture2.jpg\"></td>\n"; }*/
echo "<td><img src=\"thumb.php?pth=".$soubor."&fname=".$soubor."\"></td>\n";
if (file_exists($path.$folder."/".$soubor."/DOC/HTML/".$soubor.".".$lang.".html")) {
echo "<td><b><a href=\"".$www.$folder."/".$soubor."/DOC/HTML/".$soubor.".".$lang.".html\">".$soubor."</a></b></td>\n";
} else { echo "<td><b>".$soubor."</b></td>\n"; }
/Web/thumb.php
0,0 → 1,65
<?php
 
function file_type($file){
$path_chunks = explode("/", $file);
$thefile = $path_chunks[count($path_chunks) - 1];
$dotpos = strrpos($thefile, ".");
return strtolower(substr($thefile, $dotpos + 1));
}
 
$path = "/var/www/Modules/".$HTTP_GET_VARS["pth"]."/";
$filename = $HTTP_GET_VARS["fname"]."_Small.jpg";
// $thumbnail = thumbnail_name($filename);
$extension = file_type($filename);
$remove_thumb = false;
$img_size = array();
$width = "150";
$height = "150";
 
if (!file_exists("/tmp/".$filename)) {
 
if(in_array($extension, array('png', 'gif', 'jpg', 'jpeg'))){
if(!$img_size = getimagesize($path.$filename)){
$remove_thumb = true;
}
if($extension == 'gif'){
if(!$image = imagecreatefromgif($path.$filename)){
$remove_thumb = true;
}
}elseif($extension == 'png'){
if(!$image = imagecreatefrompng($path.$filename)){
$remove_thumb = true;
}
}elseif($extension == 'jpg' || $extension == 'jpeg'){
if(!$image = imagecreatefromjpeg($path.$filename)){
$remove_thumb = true;
}
}
$img_height = $img_size['1'];
$img_width = $img_size['0'];
if($img_width > $img_height){
$thumb_width = $width;
$thumb_height = ($img_height)*($height/$img_width);
}elseif($img_width < $img_height) {
$thumb_width = ($img_width)*($width/$img_height);
$thumb_height = $height;
}elseif($img_height == $img_width) {
$thumb_width = $width;
$thumb_height = $height;
}
if($remove_thumb == false){
$thumb = imagecreatetruecolor($thumb_width, $thumb_height);
imagecopyresampled($thumb, $image, 0, 0, 0, 0, $thumb_width, $thumb_height, $img_size[0], $img_size[1] );
imagejpeg($thumb, "/tmp/".$filename);
 
}
}else{
$remove_thumb = true;
}
 
}
 
 
header("Content-type: image/jpeg");
readfile("/tmp/".$filename);
?>