Jump to content

Add Image To Account Via Url


ColdEdge

Recommended Posts

Hi, I am wondering what do I have to do so for example. Ones a member is logged in into his/her account and when go to their account to edit there infofmation such as E-Mail, Password, Location and others they can edit there avatar via URL, so lets say they go to there user My Controls and click one of the tab's called Edit Account they will see all the fieds that are stated on top, but they will also see Avatar: <input type='text' value='http://static.mysite.com/images/defult_1.jpg' id='txt' /> I need help to make this the avatar can only bee .JPG, .PNG, .GIF and max dimensions are 100x100 pixels the size I think dosent play a role as the avatar will be hosted of 3rd party site's URL and there for dosent consume any space on the server disk...So if he/she wants to change there avatar they only click on avatar input field and remove this (http://static.mysite.com/images/defult_1.jpg) and then add there avatar URL like this (http://static.image.hosting.org/img/bb/05.jpg) the avatar will be loaded and shown instead of (http://static.mysite.com/images/defult_1.jpg) underneath Avatar field.But if some one can help to do something like Avatar:(edit) when they click edit a small window will open witch will ask for avatar URL and when you click Update it will close it self and the avatar will be shown under Avatar:(edit)-Thank You for support...

Link to comment
Share on other sites

Yeesh, that spelling is pretty brutal.You'll want to store the images on your server, regardless of how they specify what image to use. It would be easy enough for someone to upload a new image with the same filename that would bypass your validation, and you don't want to validate the image every time you show it. Saving the avatar should have the server download the image, resize it if necessary, and save it on the server. That way you only have to validate the image once, and they can't change the image without going through validation again. You can use PHP's file_get_contents function to download and save the image onto the server before checking the size and whatever else.

Link to comment
Share on other sites

Lol... I know Justsomeguy spelling is just not my thing ^^So is there any way you can provide me with the script? I am a full pledged noob and file_get_content dosent tell me alot ^^All I need is an ability to upload avatar and to show it under Avatar: field and have the ability to use <?php $avatar = $_POST['avatar']; ?> so that PHP can re-call the avatar from MySQL and then echo it in the main page... that if they updated there avatar to custom avatar not the defult avatar which is like an MSN style No-Image avatar...

Link to comment
Share on other sites

I don't have a script available that does all of that.This is the reference page for file_get_contents:http://www.php.net/manual/en/function.file-get-contents.phpYou can use it to read the data from any file. You would use file_put_contents to save the data as a file on your server:http://www.php.net/manual/en/function.file-put-contents.phpOnce the file is saved, you can use getimagesize to get information about it, including the dimensions:http://www.php.net/manual/en/function.getimagesize.phpThere are several techniques on this forum and online in general to use for things like checking the extension and resizing the image. If you haven't worked with forms yet, go over the sections about using forms with PHP, and the same for file uploads. The manual on php.net has sections that explain both of those.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...