I currently use a upload function to upload GIF images to my server.
// Upload Large Image
$upload_path = $_SERVER['DOCUMENT_ROOT']."/images/largeimages/";
$upload_name = $product_id.".gif";
$File = $_FILES['img']['tmp_name'];
$FileCopyWorked = @copy("$File", "$upload_path$upload_name");
if ($FileCopyWorked) {
echo "Large image has been uploaded successfully<br />";
}
else
{
echo "Large image has not been uploaded please upload it manually.<br />";
}
// Upload Thumbnail Image
$upload_t_path = $_SERVER['DOCUMENT_ROOT']."/images/thumbnails/";
$upload_t_name = $product_id.".gif";
$File_t = $_FILES['Thumbimg']['tmp_name'];
$FileCopyWorked = @copy("$File_t", "$upload_t_path$upload_t_name");
if ($FileCopyWorked) {
echo "Small image has been uploaded successfully<br />";
}
else
{
echo "Small image has not been uploaded please upload it manually.<br />";
}
I use this function 3 times every time I need to upload a new image because I use 3 different sizes of image for the website.
Therefore I change the image size to what I need with Photoshop.
I want the function to do it automatically, but I have absolutely no idea where to start.
Could anyone come up with a piece of code which would move the image from the directory above to a new directory called /thumbnails/ but with a size of 100pixels by 100pixels.
Remember, I am using GIF files, I have been told that this may cause a problem.
Please help.........