I have a web page that uploads images (one by one) to a directory on the web server.
Trouble is, people could upload 2mp images and that is way too big for the site to display; it needs to be only 700 pixels wide, or 800 tops!
I have found a few scripts that do resizing, but none that appear to be straight forward, or that will work with an "upload" script.
My upload script is:
Code: Select all
$photo=$_POST['photo'];
$pic=($_FILES['photo']['name']);
$target = $_SERVER['DOCUMENT_ROOT']."/images/productphotos/";
srand(time());
$random = (rand()%99999999);
$pic=($_FILES['photo']['name']);
$newname="$random"."$pic";
$target = $target . $newname;
if(move_uploaded_file($_FILES['photo']['tmp_name'], $target))
{
echo "happy days";
}Can anyone please help?