include ('settings.php');
$id = stripslashes($_GET['id']);
if (isset($_GET['id'])){
$map = scandir($id);
//---------------------------------------------------------
/*if ($handle = opendir('fotomappen/'.$_GET['id'])) {
while (false !== ($dirfile = readdir($handle))) {
$map[$inc++] = $dirfile;
}
closedir($handle);
}
*/
//---------------------------------------------------------
$teller = 0;
foreach ($map as $pics){
if (strtolower(strrchr($pics,'.')) == '.jpg'){
$teller++;
$pz = getimagesize($id.'/'.$pics);
if ($pz[0] < $pz[1]){
$factor =$thumb_size/$pz[1];
}else{
$factor =$thumb_size/$pz[0];
}
if ($pz[0] < $pz[1]){
$ratio =$pic_size/$pz[1];
}else{
$ratio =$pic_size/$pz[0];
}
if ($ratio != 1){
if ($_SERVER['SERVER_NAME'] != 'localhost'){
$conn_id = ftp_connect($ftpserver);
ftp_login($conn_id, $login, $pass);
ftp_site($conn_id, 'CHMOD 0777 '.$rootdir.$id.'/'.$pics);
ftp_close($conn_id);
}
ParsePicture($id.'/'.$pics,$pic_size);
}
$tooltip = $pics;
echo '

';
}
}
if ($teller == 0){
echo '
Geen foto\'s
gevonden !';
}
}
function ParsePicture($filename,$size) {
//@chmod($filename, 0666);
if (!file_exists($filename)) {
echo 'niet gedaan' ;
exit;
}
$longestsize = $size;
$pix_size = GetImageSize($filename);
$width = $pix_size[0];
$height = $pix_size[1];
if ($width>$height){
//liggend
$ratio = $longestsize / $width;
}else{
//staand
$ratio = $longestsize / $height;
}
//--resize picture-------------------------------------------------------------------------
if ($ratio != 1){
$original = ImageCreateFromJPEG($filename);
$twidth = $width * $ratio;
$theight = $height * $ratio;
$foto = ImageCreateTrueColor($twidth,$theight);
imagecopyresampled($foto,$original,0,0,0,0,$twidth,$theight,imagesx($original),imagesy($original));
imagejpeg($foto,$filename,75);
imagedestroy($foto);
imagedestroy($original);
//unlink($filename);
}
} //end function
?>