I am struggling with a small piece of code, which I want to use to upload a thumbnail of an uploaded image.
I am managing to upload the original fine, but what I then want to do is :
1. resize the image using imagecopyresized and
2. save the resultant image in another folder on the server by ftp using ftp_put
This code is not working for me and I just have no idea what I am doing wrong, I have been able to find nothing to help me on the internet, hours of looking around.
Code: Select all
//this file comes from a form
$tmp_image=imagecreatefromjpeg($_FILES['uploadedfile']['tmp_name']);
//make blank image of correct proportions
$new_image = imagecreatetruecolor($new_width,$new_height);
//copy the uploaded image onto this new blank image, scaled.
ImageCopyResized($new_image, $tmp_image,0,0,0,0, $new_width, $new_height, $width, $height);
//connect ftp
$conn_id = ftp_connect('$ftp');
ftp_login($conn_id,$username,$password);
//this is what I'd like to be able to do but it is just giving me a blank image.
//ftp_fput($conn_id,'wwwroot/naomi.jpeg', $fp, FTP_BINARY);
fclose($fp);