<?php if(!isset($_POST['Submit'])) { ?> <form name="form1" method="post" action="" enctype="multipart/form-data">
<table width="219" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="219"><b>Foto toevoegen:</b></td>
</tr>
<tr>
<td height="33"> <table width="0%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="40" align="center">1</td>
<td width="40" align="center">2</td>
<td width="40" align="center">3</td>
<td width="40" align="center">4</td>
<td width="40" align="center">5</td>
<td width="40" align="center">6</td>
</tr>
<tr>
<td align="center"><input name="fotoalbum" onFocus="this.style.backgroundColor='#EFEFEF'" onBlur="this.style.backgroundColor='#F7F7F7'" type="radio" value="1"></td>
<td align="center"><input name="fotoalbum" onFocus="this.style.backgroundColor='#EFEFEF'" onBlur="this.style.backgroundColor='#F7F7F7'" type="radio" value="2"></td>
<td align="center"><input name="fotoalbum" onFocus="this.style.backgroundColor='#EFEFEF'" onBlur="this.style.backgroundColor='#F7F7F7'" type="radio" value="3"></td>
<td align="center"><input name="fotoalbum" onFocus="this.style.backgroundColor='#EFEFEF'" onBlur="this.style.backgroundColor='#F7F7F7'" type="radio" value="4"></td>
<td align="center"><input name="fotoalbum" onFocus="this.style.backgroundColor='#EFEFEF'" onBlur="this.style.backgroundColor='#F7F7F7'" type="radio" value="5"></td>
<td align="center"><input name="fotoalbum" onFocus="this.style.backgroundColor='#EFEFEF'" onBlur="this.style.backgroundColor='#F7F7F7'" type="radio" value="6"></td>
</tr>
</table></td>
</tr>
<tr>
<td height="19"> </td>
</tr>
<tr>
<td height="33"><table width="219" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="219"><input type="file" name="afbeelding"></td>
</tr>
<tr>
<td><input type="submit" onFocus="this.style.backgroundColor='#EFEFEF'" onBlur="this.style.backgroundColor='#F7F7F7'" name="Submit" value="Uploaden"></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td> </td>
</tr>
</table></td>
</tr>
</table>
</form>
<br>
<?php } else {
if($_POST['fotoalbum'] == "") {
$error[] = 'Je moet wel een fotonummer aanvinken!';
}
/* foto worden opgeslagen */
$locatie = "images/fotoalbums/";
/* thumbnail */
$thumb = "images/fotoalbums/thumbnails/";
{
//controleer grootte
if($_FILES['afbeelding']['size']>55768)
{ //bepaal zelf de max. grootte in bytes
$error[] = 'Het bestand is te groot.';
}
/* size controle */
if($img_sz[0] > "400" || $img_sz[1] > "400")
{
$error[] = 'Avatar mag max. 100 x 100 pix. hebben!';
}
/* ext controle */
if(!eregi("((.jpg|.png)$)", $_FILES['afbeelding']['name'])) {
$error[] = 'Zo te zien is het geen .jpg / .png bestand!';
}
/* avatar veranderen in gebruikersnaam */
$foto = $gg_gebruikersnaam.$_POST['fotoalbum'].".jpg";
{
$error[] = 'Kan avatar niet verplaatsen.';
}
else
{
/*
#############################################
` */
$des = 'images/fotoalbums/thumbnails/ .$foto. /';
$q = 50;
$sz = 100;
function makethumb($locatie,$des,$q, $sz) {
// header("Content-type: image/jpeg");
// header("Cache-Control: no-cache");
$im = imagecreatefromjpeg($locatie);
$im_width=imageSX($im);
$im_height=imageSY($im);
if($im_width >= $im_height) {
$factor = $sz / $im_width;
$new_width = $sz;
$new_height = $im_height * $factor;
} else {
$factor = $sz / $im_height;
$new_height = $sz;
$new_width = $im_width * $factor;
}
$new_im=ImageCreate($new_width,$new_height);
ImageCopyResized($new_im, $im, 0, 0, 0, 0, $new_width, $new_height, $im_width, $im_height);
imagejpeg ($new_im,$des,$q);
ImageDestroy($im);
ImageDestroy($new_im);
}
makethumb($locatie,$des,$q,$sz);
}
} else {
$error[] = 'Het uploaden is mislukt.';
}
$fouten = sizeof($error); // aantal errors tellen if($fouten != 0) { // Er is minstens 1 error
echo 'Er zijn fouten door:'; for($i = 0; $i < $fouten; $i++) {
echo '<li>'.$error[$i].'</li>'; }
echo '<a href="javascript:history.go(-1)">Ga terug!</a>'; } else {
mysql_query("UPDATE leden SET fotoalbum".$_POST['fotoalbum']." ='". $foto ."' WHERE gebruikersnaam='".$gg_gebruikersnaam."'"); // echo "<p align='center'><img src='images/load.gif' alt=''><br>
//Ogenblik geduld a.u.b.</p>
//<META HTTP-EQUIV=Refresh CONTENT='2; URL=?action=panel/wijzig_fotoalbum'>";
}
}
?>