Welcome Guest, Not a member yet? Register   Sign In
Use avatar from file or url
#3

[eluser]jedd[/eluser]
[quote author="Sein Kraft" date="1260081822"]
I've a simple file uploader wich set the avatar for the user but i want also add an input for set the avatar from url.
[/quote]

I'm going to ignore your upload process and code, because uploading files is covered in detail elsewhere, and I don't think (?) this is the root of the question you're asking. I think you're asking how you can allow for a URL for an avatar or a file that the user has uploaded.

Is this right? If so, read on.

How I'd do it is .. have a flag in the user table that denotes the preference on local image or URL. Have space in the user table for the URL to reside. Have a directory somewhere that contains avatars, with the name of the file being the user.id or user.name - ie. unique to that user.

A function that says 'get url for user X's avatar' - takes a single parameter of user.id, and returns a string (url). Internally the function checks for the user table flag that denotes local .v. remote URL, if the latter returns it. If the former it creates a url based on the local web path / file system.

I'm not sure what performance issues you're expecting - the above is fairly streamlined, I think.


Messages In This Thread
Use avatar from file or url - by El Forum - 12-05-2009, 06:43 PM
Use avatar from file or url - by El Forum - 12-07-2009, 06:09 AM
Use avatar from file or url - by El Forum - 12-07-2009, 07:39 AM
Use avatar from file or url - by El Forum - 12-07-2009, 08:46 AM
Use avatar from file or url - by El Forum - 12-07-2009, 09:03 AM
Use avatar from file or url - by El Forum - 12-07-2009, 09:08 AM
Use avatar from file or url - by El Forum - 12-07-2009, 09:49 AM
Use avatar from file or url - by El Forum - 12-13-2009, 04:36 PM



Theme © iAndrew 2016 - Forum software by © MyBB