elseif ($_GET[module]=='uploadkoleksifoto'){
$tmpl_pwd=mysql_query("select * from member where username='$_SESSION[namamember]'");
while($tpl_pwd=mysql_fetch_array($tmpl_pwd)){
$username=$tpl_pwd[username];
$id_member=$tpl_pwd[id_member];
}
function getExtension($str) {
$i = strrpos($str,".");
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
$filename = stripslashes($_FILES['foto']['name']);
$extension = getExtension($filename);
$extension = strtolower($extension);
if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png"))
{
echo"Field gambar masih kosong....!!!!<br>Mohon Lengkapi Kembali!!!";
echo"<br><a href=javascript:history.go(-1)><b>Ulangi Lagi</b></a>";
}
else{
if(is_uploaded_file($_FILES['foto']['tmp_name'])){
if (isset ($_FILES['foto'])){
$imagename = stripslashes($_FILES['foto']['name']);
$source = $_FILES['foto']['tmp_name'];
$target = "foto-member/".$imagename;
move_uploaded_file($source, $target);
$imagepath = $imagename;
$save = "foto-member/" . $imagename; //This is the new file you saving
$file = "foto-member/" . $imagepath; //This is the original file
list($width, $height) = getimagesize($file) ;
$modwidth = 500;
$diff = $width / $modwidth;
$modheight = $height / $diff;
$tn = imagecreatetruecolor($modwidth, $modheight) ;
$image = imagecreatefromjpeg($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 100) ;
$save = "foto-member/sml_" . $imagename; //This is the new file you saving
$file = "foto-member/" . $imagepath; //This is the original file
list($width, $height) = getimagesize($file) ;
$modwidth = 90;
$diff = $width / $modwidth;
$modheight = $height / $diff;
$tn = imagecreatetruecolor($modwidth, $modheight) ;
$image = imagecreatefromjpeg($file) ;
imagecopyresampled($tn, $image, 0, 0, 0, 0, $modwidth, $modheight, $width, $height) ;
imagejpeg($tn, $save, 100) ;
}
$query=mysql_query("insert into koleksi_foto (id_member,foto_kecil, foto_besar) values ('$id_member', 'sml_$imagename', '$imagename')") or die (mysql_error());
echo "<meta http-equiv='refresh' content='0; url=member-$id_member.html'>";
}
}
}
Gan! ada yg bs bantu kesalahannya dmn...