Hi,

i installed the script "swape gallery" from the php-builder snippet library.
It works as long as i use only .gif images but when i upload .jpg the thumbnails are created corectly but the images can not be viewed in big.

Anyone git an idea what the problem could be?

<?php
// swape.gallery by Alireza Balouch
//
//
include_once('config.php');
$ver = "1.33";
if ($_GET['path'] == "" ){ $path = $pic_path ; }
else{@$path = sg_dsc($_GET['path']);}		
$file = sg_dsc($_GET['file']);	
$path2 = sg_sc($path);					
$listing  = get_list($path);

?>
<link href="<?php print $css_file ;?>" rel="stylesheet" type="text/css">
<link rel="shortcut icon" href="./sg/assest/favicon.ico">
<script language="javascript" type="text/javascript">
function showExif(){
var ex = document.getElementById('ex');
 ex.style.visibility = 'visible';
 ex.style.overflow = 'auto';
}
function hideExif(){
var ex = document.getElementById('ex');
 ex.style.visibility = 'hidden';
 ex.style.overflow = 'hidden';

}

</script>

<h2><a href="fotoalbum.php">Fotoalbum</a></h2> 
<!-- <div class='sg_head'><h2><a href="./"><?php print $gallery_name; ?></a></h2></div> -->
<?php
$exit = '<div class="sg_exlink"><a href="#" onClick="hideExif()" >Exit</a></div>';

if ($file != ""){	$pic = resize_pic($path . "/" . $file );  }
 echo '<div class="sg_sg"><table border="0" width="100%"><tr><td valign="top" width="160">
 <div class="sg_menu">' , make_menu("") , '</div></td><td>' ;		
 echo '<table border="0" width="100%"><tr><td><div class="sg_path">' , $path  , '</div></td></tr><tr><td valign="top"><div class="sg_list">',    $listing, '</div></td></tr><tr><td valign="top"><div class="sg_pic"><a href="'.$path.'/'.$file.'">' , $pic  , '</a></div></td></tr></table></td></tr></table></div>' ;
 echo '<div id="ex" class="sg_ex" style="visibility:hidden;" >' , $exit , '<br>' ;	
$exif = exif_read_data( $path . "/" . $file , 0, true);
foreach ($exif as $key => $section) {
   foreach ($section as $name => $val) {
       echo "$key.$name: $val<br />";
   }
} 
echo '<br>' , $exit ,' </div>';

//-------------------------------------------
function show_pic($p , $f , $e ,  $thumb){
   $file = $p . $f; 
   if ($thumb){ $file =  $p . $thumb_cat . "/" . $f; }
   $img = '<img id="picture" src="$file" border="0" alt="$file" />';
   return $img ;
}
//-------------------------------------------
function resize_pic($pic){
	global $im_max_x , $im_max_y;
	$exif = "";
	$neww = "" ;
	    $the_list = explode('.', $pic);
		$nr = count($the_list);
		$e = $the_list[$nr - 1];	// last .
        $e = strtolower($e);
		if ($e == "jpg" OR $e == "jpeg"){
			$im = @imagecreatefromjpeg($pic);
			$exif = '<br><a href="#" onClick="showExif();"><img src="./sg/assest/e.png" lat="EXIF info" border="0"></a>';
		}
		elseif ($e == "png" ){
		    $im = @imagecreatefrompng($pic );
		}
		elseif($e == "gif" ){
			$im =@imagecreatefromgif($pic);
		}
		if ($im != ""){
			$x = imagesx($im);	$y = imagesy($im);
			$x1 = $x ; $y1 = $y;
			if ($y >= $im_max_y OR $x >= $im_max_x){
				$el = "<a href='$pic' target='$pic'>";
				$le = "</a>";
				$ref = $im_max_x / imagesx($im); $y = imagesy($im) * $ref ; $x = $im_max_x;
				$neww = $el . '<img src="./sg/assest/full.png" lat="Org. size (in new window)" border="0">' . $le  ;

			if ($y >= $im_max_y ){$y = $im_max_y; $ref = $im_max_x / imagesy($im ); $x = imagesx($im) * $ref;	}
			$x =round($x);
			$y =round($y);
		}
	}
$pai = '<img src="' . $pic . '" width="' . $x .'" height="' . $y . '" alt="' . $pic . '" border="0" />' ;
$menu = $neww . $exif ;
$tab = '<table class="sg_pict" cellpading="0" cellspacing="0"><tr><td width="20" align="center" valign="top">' . $menu . '</td><td>' . $pai . '</td></tr></table>';
return $tab ;//$pai; 
}
//-------------------------------------------
function sg_sc($input){  
$input = str_rot13($input); $input = str_replace("/" , "_sg_" , $input); return $input; } //------------------------------------------- function sg_dsc($input){ $input = str_replace( "_sg_" ,"/" , $input); return str_rot13($input); return $input; } //------------------------------------------- function get_list($path) { // listing pictures global $thumb_cat; if ($handle = @opendir($path)){ while (false !== ($file = readdir($handle) ) ){ if ($file[0] == ".") { } // do nothing else{ list($f , $e) = explode('.' , $file , 4); $e = strtolower($e) ; if (!is_dir($path . "/" .$file)){ $path2 = sg_sc($path); $file2 = sg_sc($file); $pathc = str_replace('.' ,'',$path); $pathc = str_replace('/','',$pathc); $tfile = $thumb_cat . $pathc ."_" . $file ; thumb($path . "/" , $file); $dir = $dir . '<div class="sg_item"><a href="?path=' . $path2 . '&file=' . $file2 .'"> <img src="' . $tfile . '" alt="' . $file . '" border="0" /><br /></a></div>'; } } }//while }//if return $dir; } //------------------------------------------- function thumb( $path , $picture ){ global $thumb_cat , $im_th_x ,$im_th_y,$conpath ; if ($picture != ''){ $pathc = $path; $path = str_replace('.' ,'',$path); $path = str_replace('/','',$path); $tfile = $thumb_cat . $path ."_" . $picture ; $convert = "$conpath -sample " . $im_th_x ."x". $im_th_y ." " . $pathc . "/" . $picture." " . $tfile; if (!is_file($tfile)){ @chmod($thumb_cat , 777); exec($convert ,$a); //chmod($thumb_cat , 755); } if ($a != ""){ foreach($a as $b=>$c){ $d = $d . $b . "--" . $c; } } } } //------------------------------------------- function make_menu($path){ global $pic_path; if ($path == "") { $path = $pic_path ; } if ($handle = @opendir($path)){ $out = "<div class='sg_menu_item'>"; while (false !== ($file = readdir($handle) ) ){ if (is_dir($path . "/". $file) AND substr($file ,0,1) != "."){
$path2 = sg_sc($path . "/" .$file); $file3 = str_replace('_',' ',$file); $out = $out . '<a href="?path=' . $path2 . '">' . $file3 . '</a>'; $out = $out . make_menu($path . "/" . $file ); } } $out = $out . "</div>"; } return $out ; } ?>
    Write a Reply...