<?phpfunction file_type($file){$path_chunks = explode("/", $file);$thefile = $path_chunks[count($path_chunks) - 1];$dotpos = strrpos($thefile, ".");return strtolower(substr($thefile, $dotpos + 1));}/*PØI ZMÌNÌ NASTAVENÍ JE NUTNO VYMAZAT TEMP!!!*//*Absolutní cesta k obrázku ($HTTP_GET_VARS["pth"]=parametr pth v adrese stránky)*/$path = "/var/www/Modules/".$HTTP_GET_VARS["pth"]."/";/*Absolutní cesta k náhledu*/$path1 = "/tmp/";/*íøka náhledu*/$width = "150";/*Výka náhledu*/$height = "150";/*Pokud obrázek existuje dej do promìnné filename jeho cestu jinak tam dej cestu k obrázku nopicture2*/if (file_exists($path.$HTTP_GET_VARS["fname"]."_Small.jpg")) {$filename = $HTTP_GET_VARS["fname"]."_Small.jpg";} else {$filename = "nopicture2.jpg";$path = "/var/www/Web/PIC/";}$extension = file_type($filename);$remove_thumb = false;$img_size = array();/*Pokud obrázek v tempu neexistuje potom...*/if (!file_exists($path1.$filename)) {/*Naètení obrázku*/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;}}/*Zmìna velikosti a zaøízení neporuení pomìru stran*/$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);/*Pøeveï...*/imagecopyresampled($thumb, $image, 0, 0, 0, 0, $thumb_width, $thumb_height, $img_size[0], $img_size[1] );/*Pokud se má v rohu obrázku zobrazit text 'www.mlab.cz' potom odkomentovat následující 2 øádky a vymazat temp*/// $black = ImageColorAllocate($thumb, 0, 0, 0);// if ($filename <> "nopicture2.jpg") {ImageString ($thumb, 3, $thumb_width-80, $thumb_height-15, "www.mlab.cz", $black);}/*Ulo obrázek!!!*/imagejpeg($thumb, $path1.$filename);}}else{$remove_thumb = true;}}/*Zobraz obrázek!!!*/header("Content-type: image/jpeg");readfile($path1.$filename);?>