![]() |
![]() |
![]()
Post
#1
|
|
Grupa: Zarejestrowani Postów: 5 Pomógł: 0 Dołączył: 25.12.2005 Ostrzeżenie: (10%) ![]() ![]() |
Witam specjalistów!
Mam galerie w któej klikam na minature i wyswoetal mi sie duże zdjęcie w oknie o rozmiarach 700x500 i do wszystkich zdjęć i widac troche białego tła. Chciałbym żeby okno było automatycznie dopasowane do każego zdjęcia np. jak mam zdjecie o wymiarach w=500 i sz= 200 to żeby okono otwierało sie o takich samych wymiarach, a jeśli mam zdjęcie o wymiarach w=200 i sz=500 to też żeby okno sie dopasowało do zdjęcia. A i zeby mianatury byly bez obramowań. A i galeria jest napisana w php, poniżej jest kod. Jak zmienić ten skrypt?? Proszę o pomoc ! Z góry dziękuje Kod <script language="JavaScript" type="text/JavaScript">
<!-- function MM_openBrWindow(theURL,winName,features) { //v2.0 window.open(theURL,winName,features); } //--> </script> <?php $_config["url"] = "http://members.lycos.co.uk/czerwony222/galeria.php"; $_config["dir"] = "obrazki"; $_config["cache"] = "min"; $_config["th_max_width"] = 50; $_config["th_max_height"] = 50; $_config["columns"] = 2; $_config["rows"] = 6; $_config["ext"] = "jpg|gif|png"; function CreateThumb($file, $w, $h, $dest="", $p=1) { if(!file_exists($file)) return 0; $file_ex = explode("/", $file); $filename = $file_ex[count($file_ex)-1]; list($width, $height, $type) = getimagesize($file); switch($type) { case 1: $imagecreate = "imagecreatefromgif"; $imagesave = "imagegif"; break; case 2: $imagecreate = "imagecreatefromjpeg"; $imagesave = "imagejpeg"; break; case 3: $imagecreate = "imagecreatefrompng"; $imagesave = "imagepng"; break; default: return 0; break; } $im = $imagecreate($file); if($p) { $prop = $height / $width; $nw = $w; $nh = $w * $prop; } else { $nw = $w; $nh = $h; } $dest_im = imagecreatetruecolor($nw, $nh); imagecopyresized($dest_im, $im, 0, 0, 0, 0, $nw, $nh, $width, $height); $imagesave($dest_im, $dest."/".$filename); return 1; } $dir = dir($_config["dir"]); $pliki = array(); while($file = $dir->read()) { if(eregi("(".$_config["ext"].")$", $file)) { $pliki[] = $file; } } if(!isset($_GET["gp"])) $gp = 0; else $gp = $_GET["gp"]; $_start = $gp*$_config["rows"]*$_config["columns"]; $_stop = $_start + $_config["rows"]*$_config["columns"]; echo "<table style=\"width: 100%; border: 0;\">\n"; for($i=$_start, $j=0; $i<$_stop && $i<count($pliki); $i++, $j++) { if($j == $_config["columns"]) { echo "</tr><tr>"; $j = 0; } if(!file_exists($_config["cache"]."/".$pliki[$i])) CreateThumb($_config["dir"]."/".$pliki[$i], $_config["th_max_width"], $_config["th_max_height"], $_config["cache"]); echo "<td style=\"width: ".(100/$_config["columns"])."%; text-align: center;\">\n" ."<a href=\"#\" onClick=\"MM_openBrWindow('".$_config["dir"]."/".$pliki[$i]. "','gallery_window','width=700','height=500');\"><img src=\"".$_config["cache"]."/".$pliki[$i]. "\" alt=\"Gallery\" /> </a>\n" ."</td>\n"; } echo "</table>\n"; if(count($pliki) > $_stop && $_start == 0) { $npage = $gp + 1; echo "<div style=\"text-align: center;\"><a href=\"".$_config["url"]."gp=".$npage."\" class=\"gal_navlink\">Następna strona »</a></div>\n"; } if(count($pliki) <= $_stop && $_start > 0) { $ppage = $gp - 1; echo "<div style=\"text-align: center;\"><a href=\"".$_config["url"]."gp=".$ppage."\" class=\"gal_navlink\">« Poprzednia strona</a></div>\n"; } if(count($pliki) > $_stop && $_start > 0) { $ppage = $gp - 1; $npage = $gp + 1; echo "<div style=\"text-align: center;\"><a href=\"".$_config["url"]."gp=".$ppage."\" class=\"gal_navlink\">« Poprzednia strona</a> | <a href=\"".$_config["url"]."?gp=".$npage."\" class=\"gal_navlink\">Następna strona »</a></div>\n"; } ?> Ten post edytował czerwony 13.03.2006, 13:18:30 |
|
|
![]() ![]() |
![]() |
Aktualny czas: 20.08.2025 - 07:12 |