Script #1 resizes uploaded images and saves them to my "newphotos" folder as "resized.jpeg" or any other name I choose.
Script #2 does the same thing but names the uploaded image with the user's name from the input form.
I need to know which photo goes with which user, but can't get script #2 integrated properly into script #1. I've tried replacing $image->save in Script #1 with the move function from Script #2 with all sorts of variations with no success.
I'm just learning PHP code so any help coming my way would be very appreciated. Thanks,
~Bill
Script #1
<?php
if( isset($POST['submit']))
{
include('2.photo.processor.php');
$image = new SimpleImage();
$image->load($FILES['uploaded_image']['tmp_name']);
$image->resizeToWidth(450);
$image->save('newphotos/resized.jpeg');
header('Location: 3.alumni.success.php');
}
?>
Script #2
<?php
if ($FILES["file"]["error"] > 0) {
echo "Return Code: " . $FILES["file"]["error"] . "<br />";
} else {
move_uploaded_file($FILES["file"]["tmp_name"], "newphotos/{$POST['lastname']}.{$_POST['firstname']}.jpeg");
}
?>
<div style="margin-top:100px; text-align:center;">
<form method="POST" enctype="multipart/form-data">
<input type="file" name="file"><br /><br />
First Name<input type="text" name="firstname"><br />
Last Name <input type="text" name="lastname"><br /><br />
<input type="submit" value="submit">
</form>