PHP Scale / Resize Image on upload
Hello all,
I have created a fairly simple script that accompanies a form enabling a user to upload an image to my website. This works fine.
The problem I have is I want to scale the image on upload so that it is stored at the smaller size of 110 x 104. I have searched for a simple bit of code that will allow me to do this but have had no luck.
This is what my script currently looks like:
Quote:
<?php
if ((($_FILES["file"]["type"] == "image/gif")
|| ($_FILES["file"]["type"] == "image/jpeg")
&& ($_FILES["file"]["type"] == "image/pjpeg"))
{
if ($_FILES["file"]["error"] > 0)
{
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
}
else
{
echo "Success";
if (file_exists("upload/" . $_FILES["file"]["name"]))
{
echo "Error";
}
else
{
move_uploaded_file($_FILES["file"]["tmp_name"],
"upload/" . $_FILES["file"]["name"]);
echo "Stored in: " . "upload/" . $_FILES["file"]["name"];
$filename = ("upload/" . $_FILES["file"]["name"]);
}
}
}
else
{
die('Error');
}
?>
Any help at all would be HUGELY appreciated, Huge kudos to anyone that can provide me with a good fairly simple solution!
Thank you in advance.