[python-chinese] [django] 图片路径在IE和MF显示问题。
lendcomcn
lendcomcn在gmail.com
星期二 九月 5 16:54:01 HKT 2006
呵呵,谢谢兄弟。。。
2006/9/4, 马踏飞燕 <honeyday.mj at gmail.com>:
> 自己手工解决一下嘛!
> 写一个filter,把里面的反斜线转换成正斜线就可以啦!
>
> #coding=utf-8
> from django import template
> import string
>
> register = template.Library()
>
> def b2f(value):
> """将反斜线转换为正斜线,用作对上传得文件路径作转换。"""
> return string.replace(str(value), '\\','/')
>
> register.filter('b2f',b2f)
>
> 接下来在显示图片的时候对那个数据库的字段应用一下这个就ok了。
>
> 2006/9/4, lendcomcn <lendcomcn at gmail.com>:
> > 我在浏览器上传图片后,django在mysql数据保存的路径是userphoto\111.jpg
> >
> > 在IE显示的图片的时候会自动把 \ 转换成 /
> >
> > 但在Firefox显示图片的时候,会把 \ 解析成 %5C
> > 出现userphoto%5C111.jpg ,图片不能正常显示。
> > Firefox不能自动换成为 /
> >
> > 这个应该如何解决呀?
> > _______________________________________________
> > python-chinese
> > Post: send python-chinese at lists.python.cn
> > Subscribe: send subscribe to python-chinese-request at lists.python.cn
> > Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn
> > Detail Info: http://python.cn/mailman/listinfo/python-chinese
> _______________________________________________
> python-chinese
> Post: send python-chinese at lists.python.cn
> Subscribe: send subscribe to python-chinese-request at lists.python.cn
> Unsubscribe: send unsubscribe to python-chinese-request at lists.python.cn
> Detail Info: http://python.cn/mailman/listinfo/python-chinese
关于邮件列表 python-chinese 的更多信息