Mick
Mick

Reputation: 31919

Store a picture in a cookie

I would like to store a small profile picture of my users in their browser so that they can see their profile picture (in the login form) each time they log in (when they tick remember me for example). I think hotmail is doing something similar.

Is it possible to store the image on the user computer and store the path in a cookie? It seems that the maximum size of a cookie is 4096 Bytes so it might be hard to store the image itself in a cookie. Do you have any ideas how I could do that?

Upvotes: 11

Views: 14848

Answers (4)

Robbie
Robbie

Reputation: 17720

Surely it's more efficent to store a link to an online image in the cookie, and use that instead?

Each time a webpage is browsed, the cookies get transmitted - storing an image will add unecessary bandwidth.

Upvotes: 15

DaneSoul
DaneSoul

Reputation: 4511

Why you don't want to store picture on server and store the path in cookie?

This looks more situable, then write additional data on user computer...

Upvotes: 5

Paul Sham
Paul Sham

Reputation: 3205

Could you store the path to the image in a cookie and use the value to render it in the login screen?

Upvotes: 5

Related Questions