Computing.Net > Forums > Web Development > Upload resized image in PHP

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Upload resized image in PHP

Reply to Message Icon

Name: kyleinc
Date: March 2, 2005 at 16:14:57 Pacific
OS: Linux
CPU/Ram: Irrelevant
Comment:

I am using the image resize script found at: http://codewalkers.com/tutorials/42/1.html . However, rather than simply display the image after I resize it, I want to upload it to my webserver, preferrably with FTP (so that I don't have to worry about maximum file sizes).

I tried using the ftp_put($ftp,$filename,$img,FTP_BINARY) thing, but the third parameter needs a string (the source filename), but I would be sending it a file (the resized image).



Sponsored Link
Ads by Google

Response Number 1
Name: Dr. Nick
Date: March 2, 2005 at 22:13:40 Pacific
Reply:

I think you'll need to write the file to the disk first.

How is the image being stored? You might try writing it to a file using the image<type>() function, then FTPing that.

If you were using PNG, you could do something like this:

//create unique filename
$imgName = date('hms') . rand(1, 1000);

//output image
ImagePng($img, "$imgName.png");

//upload with FTP
ftp_put($ftp, $remoteFilename, $imgName, FTP_BINARY)

Something like that work for you?



0
Reply to Message Icon

Related Posts

See More







Post Locked

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.


Go to Web Development Forum Home


Sponsored links

Ads by Google


Results for: Upload resized image in PHP

how to display images in PHP www.computing.net/answers/webdevel/how-to-display-images-in-php-/2164.html

Resizing image with PHP www.computing.net/answers/webdevel/resizing-image-with-php/2815.html

resize images in forums? ( BBcode) www.computing.net/answers/webdevel/resize-images-in-forums-bbcode/3817.html