2006年07月18日 星期二 16:37
几个疑问:
1 在文档里这么说ImageFild字段:
ImageField 类似 FileField, 不过要校验上传对象是否是一个合法图片.它有两个可选参数:height_field 和
width_field,如果提供这两个参数,则图片将按提供的高度和宽度规格保存.
这是否意味着所有图片都能自动缩略保存? 为什么limodou兄的woodlog不用这个呢?
2 关于文件的相对路径.我不大了解os模块 找了下,与pil一样,中文资料不多.如何去获取合适的路径呢
?如果是绝对路径,那么程序不是每换一台服务器就需要手工配置一次吗?woodlog中这样写到:
if file_obj:
path, ext = os.path.splitext(file_obj['filename'])
from utils import image
#we should delete the existed file first
if profile.portrait:
filename = profile.get_portrait_filename()
if os.path.exists(filename):
try:
os.remove(filename)
except:
pass
filename = image.get_default_thumbnail_filename(filename)
if os.path.exists(filename):
try:
os.remove(filename)
except:
pass
由于对os.path.exists以及os.remove等模块的不了解
看不大懂其作用是?
貌似暂时就这些
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060718/88d15de8/attachment.htm
2006年07月18日 星期二 16:56
风向标上传功能做玩了吗? 代码分享一下? 我好久没写了,最近又要重新开工了。 On 7/18/06, 风向标 <vaneoooo at gmail.com> wrote: > > > 几个疑问: > > 1 在文档里这么说ImageFild字段: > > ImageField 类似 FileField, 不过要校验上传对象是否是一个合法图片.它有两个可选参数:height_field 和 > width_field,如果提供这两个参数,则图片将按提供的高度和宽度规格保存. > > 这是否意味着所有图片都能自动缩略保存? 为什么limodou兄的woodlog不用这个呢? > > 2 关于文件的相对路径.我不大了解os模块 找了下,与pil一样,中文资料不多.如何去获取合适的路径呢 > ?如果是绝对路径,那么程序不是每换一台服务器就需要手工配置一次吗?woodlog中这样写到: > > > if file_obj: > path, ext = os.path.splitext(file_obj['filename']) > from utils import image > > #we should delete the existed file first > if profile.portrait: > filename = profile.get_portrait_filename() > if os.path.exists(filename): > try: > os.remove(filename) > except: > pass > filename = image.get_default_thumbnail_filename(filename) > if os.path.exists (filename): > try: > os.remove(filename) > except: > pass > > 由于对os.path.exists以及os.remove等模块的不了解 > > 看不大懂其作用是? > > > > 貌似暂时就这些 > > _______________________________________________ > 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 > > -- Regards HoLin -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.exoweb.net/pipermail/python-chinese/attachments/20060718/2c4a66f2/attachment.html
Zeuux © 2025
京ICP备05028076号