将图片存储在Cookie中 [英] Store a picture in a cookie

查看:352
本文介绍了将图片存储在Cookie中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在他们的浏览器中存储我的用户的小头像,以便他们每次登录时(例如,当记住我时)都能看到他们的头像(在登录表单中).我认为hotmail在做类似的事情.

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.

是否可以在用户计算机上存储图像并将路径存储在cookie中?似乎cookie的最大大小为

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?

推荐答案

在cookie中存储指向在线图像的链接,并使用它确实更有效吗?

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

每次浏览网页时,cookie都会被传输-存储图像会增加不必要的带宽.

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

这篇关于将图片存储在Cookie中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆