I made a site that lets you upload images with a form. On a separate page people can view these images. Since most of the images are very huge as they came directly from a camera, I used the height and width attributes of the image tags to make them a smaller size. However the page takes a long time to load and scrolling is very choppy. The best thing to do would be to use PHP to dynamically resize the images before they are saved on the server. I used this code:
$smaller = imagecreatetruecolor(300, 250);
$original = imagecreatefromjpeg("../images/tmp/$t.jpg");
list($width, $height) = getimagesize("../images/tmp/$t.jpg");
imagecopyresized($smaller, $original, 0, 0, 0, 0, 300, 250, $width, $height);
imagejpeg($smaller, '../images/properties/' . time() . $_FILES['picture']['name'], 100);
but I get an error saying that the image I am trying to resize is too large. How make this resizing work?
(Yahoo Answers cut off one of the lines and added ... for some reason)
$smaller = imagecreatetruecolor(300, 250);
$original = imagecreatefromjpeg("../images/tmp/$t.jpg");
list($width, $height) = getimagesize("../images/tmp/$t.jpg");
imagecopyresized($smaller, $original, 0, 0, 0, 0, 300, 250, $width, $height);
imagejpeg($smaller, '../images/properties/' . time() . $_FILES['picture']['name'], 100);
but I get an error saying that the image I am trying to resize is too large. How make this resizing work?
(Yahoo Answers cut off one of the lines and added ... for some reason)