0,0 → 1,48 |
<?php |
header("Content-type: image/jpeg"); |
|
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; |
|
|
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; |
} |
} |
if($remove_thumb == false){ |
|
$black = ImageColorAllocate($thumb, 0, 0, 0); |
ImageString ($thumb, 3, $thumb_width-80, $thumb_height-15, "www.mlab.cz", $black); |
imagejpeg($image); |
|
} |
}else{ |
$remove_thumb = true; |
} |
|
} |
|
?> |