views:

155

answers:

1

In the microblogging application I am developing I wish to show an user image beside each post in the timeline. The images are small in size(max 50*50 dip) and are not more than 10 in number. I've two approaches in my mind.

1) Allow user to chose an image from Gallery on signing up. Send the image to the server and on subsequent signups load the image from the server. I'm worried whether this approach is doing too much unnecessary work.

2) The same method is same as above in first step but this time the image is not send to the server but a key value associated with the image is sent to the server. On subsequent signups, after obtaining the key from the server the specific image is loaded from gallery.

I am not sure whether the second approach is possible. Any corrections on this aspect would be much appreciated.

Also, Is it possible to store an image in SharedPreferences?

Any new approach to handle this problem better are welcome.

+1  A: 

I think it clearly depends on what your trying to do. If you want to make the account available on other devices (so that the user can sign in in his account and use his image even if he's not using his mobile phone) then you should clearly upload the images to the server. But in this case, I wouldn't upload the images from the gallery directly, but first i would scale it to the necessary size and then upload this new image to the server.

Your second approach has a major drawback, your storing the key on the server, but this doesnt help a lot if the users signs in from a different device. Very pobably, this device won't have the same image, so the key is really useless. And if the user is always using the same phone, then I think it would be better if you just store the path to the image in the Shared Preferences.

Roflcoptr
Thank you. You have shown me the right path to take.
primalpop