I have a form for uploading photos in my website and use a php script to save the file. this is my php script:
$here=time();
$tmpName = $_FILES['myimage']['tmp_name'];
if($_FILES['myimage']['type']!='image/jpeg' &&
$_FILES['myimage']['type']!='image/jpg' &&
$_FILES['myimage']['type']!='image/png'){
die("wrong file type");
}else{
$target = 'photos/user='.strtolower($showusername).'&on='.$here.'.jpg';
move_uploaded_file( $_FILES['myimage']['tmp_name'], $target);
$query=mysql_query("INSERT INTO Pics(datetime,name,details)VALUES('$oni','$showusername','$det')")or die("unable to upload sorry");
}
can yo help me modify my script so that the image is resized to 50% before saving if it is larger than 500 kb?