if a user uplaods an overly large image, once it has reached its final resting place i want to resize it and then delete the old, large file. My code so far is this:
<?php
$filename = "test1.JPG";
$percent=.25;
//first resample it
// Get new dimensions
list($width, $height) = getimagesize($filename);
$new_width = $width * $percent;
$new_height = $height * $percent;
// Resample
$image_p = imagecreatetruecolor($new_width, $new_height);
$image = imagecreatefromjpeg($filename);
imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height);
//now copy it
if(!copy($image_p,"resampled_".$image_p)) {
echo "Failed to copy file.";
} else {
unlink($filename);
}
?>
however i get a warning:
Warning: copy(Resource id #3): failed to open stream: No such file or directory in c:\program files\easyphp1-8\www\resample.php on line 23
why is this doing this? Also i have no idea what Resource id #3 means, where could I find out?