Reducing image size while upload


#1

Hey all , I am working on a website on which the user has to upload images, most of the images are of large size and that takes a lot of time for the images to be uploaded, is there a way by which I can reduce the time taken by images to get uploaded, i can compromise a little with the quality.

Following is the code that i am using for uploading images!

Some urgent help would be really appretiated!

here’s the code that i have been using :
[php]

<?php $uploaddir = './uploads/'; $file = $uploaddir . basename($_FILES['uploadfile']['name']); if (move_uploaded_file($_FILES['uploadfile']['tmp_name'], $file)) { echo "success"; } else { echo "error"; } ?>

[/php]


#2

Head over php.net and look up the image functions. There’s 1 to get the image’s size. You’ll want to do any validation before the image is actually uploaded though.


#3

Well, also, BEFORE you can resize an image with PHP, you MUST load it onto the server.
Therefore, no, you can NOT speed up the upload. It still has to upload the entire file to the server.
Then, you can use the image functions to resize it. Resizing it to a smaller size can speed up the
displaying of the image after it has been reduced in size, but, not on the upload part…