2007年11月27日 星期二 03:15
ÓÃpython+djangoÀ´×ö¸öСÏîÄ¿,¸ãÁ˸öÑéÖ¤Âë,·ÀÖ¹»úÆ÷ÈËÌá½» a.py #!/usr/bin/python #coding=cp936 import Image,ImageDraw,ImageFont from django.http import HttpResponse from django.shortcuts import render_to_response def index(request): m=Image.new('RGB',(50,30),(255,255,255)) d=ImageDraw.Draw(m) ft=ImageFont.truetype("c:\\windows\\Fonts\\simsun.ttc",18) text="123" d.text((5,5),text,fill=(255,0,0),font=ft) return m.show() urlsÀïÃæ: (r'^a/$','a.index') ÏÖÔÚÎÒÓÃhttp://127.0.0.1/a ·ÃÎʵĻ°, Ö±½ÓÓÃͼƬÆ÷´ò¿ªÍ¼Æ¬ÁË. ÎÒµÄÎÊÌâÊÇ: ÎÒÔõô°ÑÕâ¸öͼƬŪµ½HTMLÀïÃæÈ¥ http://127.0.0.1/a"> ÕâÑù¾Í¿ÉÒÔÒýÓÃͼƬÁË.. -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071127/752543ef/attachment.htm
2007年11月27日 星期二 08:52
Ó¦¸ÃÒª¸Ä±äÊä³öhttpÍ·, ÀàËÆÓÚ response.header('plain/jpg') ÄãÔÚdjangoÎĵµÖÐÕÒÕÒ¿´ :) On Nov 27, 2007 3:15 AM, List <shell.lists在gmail.com> wrote: > ÓÃpython+djangoÀ´×ö¸öСÏîÄ¿,¸ãÁ˸öÑéÖ¤Âë,·ÀÖ¹»úÆ÷ÈËÌá½» > > a.py > > #!/usr/bin/python > #coding=cp936 > import Image,ImageDraw,ImageFont > from django.http import HttpResponse > from django.shortcuts import render_to_response > > def index(request): > m=Image.new('RGB',(50,30),(255,255,255)) > d=ImageDraw.Draw(m) > ft=ImageFont.truetype("c:\\windows\\Fonts\\simsun.ttc",18) > text="123" > d.text((5,5),text,fill=(255,0,0),font=ft) > return m.show() > > urlsÀïÃæ: > (r'^a/$','a.index') > > ÏÖÔÚÎÒÓÃhttp://127.0.0.1/a ·ÃÎʵĻ°, Ö±½ÓÓÃͼƬÆ÷´ò¿ªÍ¼Æ¬ÁË. > > ÎÒµÄÎÊÌâÊÇ: > ÎÒÔõô°ÑÕâ¸öͼƬŪµ½HTMLÀïÃæÈ¥ > > http://127.0.0.1/a"> ÕâÑù¾Í¿ÉÒÔÒýÓÃͼƬÁË.. > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > -- ×îºÃµÄÍƹã±ãÊÇʵ¼ÊÓ¦Óà ×î½üÔÚѧϰweb.py, ¼á³Ö²ÅÄܽø²½ http://del.icio.us/iexper http://twitter.com/qichangxing Gtalk: iexper(at)gmail.com -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071127/8432e6a2/attachment.html
2007年11月27日 星期二 10:26
¹¹Ôì¸öbuf£¬°ÑÉú³ÉµÄͼƬsaveµ½ÀïÃ棬Ȼºó·µ»Øʱָ¶¨httpÍ· buf = cStringIO.StringIO() m.save(buf, 'PNG') return HttpResponse(buf.getvalue(),'image/PNG') On 11/27/07, List <shell.lists在gmail.com> wrote: > > ÓÃpython+djangoÀ´×ö¸öСÏîÄ¿,¸ãÁ˸öÑéÖ¤Âë,·ÀÖ¹»úÆ÷ÈËÌá½» > > a.py > > #!/usr/bin/python > #coding=cp936 > import Image,ImageDraw,ImageFont > from django.http import HttpResponse > from django.shortcuts import render_to_response > > def index(request): > m=Image.new('RGB',(50,30),(255,255,255)) > d=ImageDraw.Draw(m) > ft=ImageFont.truetype("c:\\windows\\Fonts\\simsun.ttc",18) > text="123" > d.text((5,5),text,fill=(255,0,0),font=ft) > return m.show() > > urlsÀïÃæ: > (r'^a/$','a.index') > > ÏÖÔÚÎÒÓÃhttp://127.0.0.1/a ·ÃÎʵĻ°, Ö±½ÓÓÃͼƬÆ÷´ò¿ªÍ¼Æ¬ÁË. > > ÎÒµÄÎÊÌâÊÇ: > ÎÒÔõô°ÑÕâ¸öͼƬŪµ½HTMLÀïÃæÈ¥ > > http://127.0.0.1/a"> ÕâÑù¾Í¿ÉÒÔÒýÓÃͼƬÁË.. > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071127/27edf5b2/attachment-0001.html
2007年11月27日 星期二 10:46
ÏÖÔÚ²»ÊÇÓлشð¼òµ¥µÄËãÊõÎÊÌâµÄÑéÖ¤·½Ê½Âð£¬ÕâÖÖÓ¦¸Ã±È½Ï·½±ã On 11/27/07, leopay <leopay在gmail.com> wrote: > > ¹¹Ôì¸öbuf£¬°ÑÉú³ÉµÄͼƬsaveµ½ÀïÃ棬Ȼºó·µ»Øʱָ¶¨httpÍ· > buf = cStringIO.StringIO() > m.save(buf, 'PNG') > return HttpResponse(buf.getvalue(),'image/PNG') > > On 11/27/07, List <shell.lists在gmail.com> wrote: > > > ÓÃpython+djangoÀ´×ö¸öСÏîÄ¿,¸ãÁ˸öÑéÖ¤Âë,·ÀÖ¹»úÆ÷ÈËÌá½» > > > > a.py > > > > #!/usr/bin/python > > #coding=cp936 > > import Image,ImageDraw,ImageFont > > from django.http import HttpResponse > > from django.shortcuts import render_to_response > > > > def index(request): > > m=Image.new('RGB',(50,30),(255,255,255)) > > d=ImageDraw.Draw(m) > > ft=ImageFont.truetype("c:\\windows\\Fonts\\simsun.ttc",18) > > text="123" > > d.text((5,5),text,fill=(255,0,0),font=ft) > > return m.show() > > > > urlsÀïÃæ: > > (r'^a/$','a.index') > > > > ÏÖÔÚÎÒÓÃhttp://127.0.0.1/a ·ÃÎʵĻ°, Ö±½ÓÓÃͼƬÆ÷´ò¿ªÍ¼Æ¬ÁË. > > > > ÎÒµÄÎÊÌâÊÇ: > > ÎÒÔõô°ÑÕâ¸öͼƬŪµ½HTMLÀïÃæÈ¥ > > > > http://127.0.0.1/a"> ÕâÑù¾Í¿ÉÒÔÒýÓÃͼƬÁË.. > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese在lists.python.cn > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071127/53fa196d/attachment.htm
2007年11月27日 星期二 10:51
ÔÚrobert chenµÄ·½°¸ÖÐ, ÊÇÉú³ÉÁË´óÁ¿Ëæ»úµÄÑéÖ¤Âëͼ, ʹÓÃʱֱ½Óµ÷ÓÃ, ¶ø²»ÊÇʵʱÉú³É. On Nov 27, 2007 10:46 AM, @@ <askfor在gmail.com> wrote: > ÏÖÔÚ²»ÊÇÓлشð¼òµ¥µÄËãÊõÎÊÌâµÄÑéÖ¤·½Ê½Âð£¬ÕâÖÖÓ¦¸Ã±È½Ï·½±ã > > On 11/27/07, leopay <leopay在gmail.com> wrote: > > > ¹¹Ôì¸öbuf£¬°ÑÉú³ÉµÄͼƬsaveµ½ÀïÃ棬Ȼºó·µ»Øʱָ¶¨httpÍ· > > buf = cStringIO.StringIO() > > m.save(buf, 'PNG') > > return HttpResponse(buf.getvalue(),'image/PNG') > > > > On 11/27/07, List < shell.lists在gmail.com> wrote: > > > > > ÓÃpython+djangoÀ´×ö¸öСÏîÄ¿,¸ãÁ˸öÑéÖ¤Âë,·ÀÖ¹»úÆ÷ÈËÌá½» > > > > > > a.py > > > > > > #!/usr/bin/python > > > #coding=cp936 > > > import Image,ImageDraw,ImageFont > > > from django.http import HttpResponse > > > from django.shortcuts import render_to_response > > > > > > def index(request): > > > m=Image.new('RGB',(50,30),(255,255,255)) > > > d=ImageDraw.Draw(m) > > > ft=ImageFont.truetype("c:\\windows\\Fonts\\simsun.ttc",18) > > > text="123" > > > d.text((5,5),text,fill=(255,0,0),font=ft) > > > return m.show() > > > > > > urlsÀïÃæ: > > > (r'^a/$','a.index') > > > > > > ÏÖÔÚÎÒÓÃhttp://127.0.0.1/a ·ÃÎʵĻ°, Ö±½ÓÓÃͼƬÆ÷´ò¿ªÍ¼Æ¬ÁË. > > > > > > ÎÒµÄÎÊÌâÊÇ: > > > ÎÒÔõô°ÑÕâ¸öͼƬŪµ½HTMLÀïÃæÈ¥ > > > > > > http://127.0.0.1/a"> ÕâÑù¾Í¿ÉÒÔÒýÓÃͼƬÁË.. > > > > > > _______________________________________________ > > > python-chinese > > > Post: send python-chinese在lists.python.cn > > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > > > > > _______________________________________________ > > python-chinese > > Post: send python-chinese在lists.python.cn > > Subscribe: send subscribe to python-chinese-request在lists.python.cn > > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > > Detail Info: http://python.cn/mailman/listinfo/python-chinese > > > > > _______________________________________________ > python-chinese > Post: send python-chinese在lists.python.cn > Subscribe: send subscribe to python-chinese-request在lists.python.cn > Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn > Detail Info: http://python.cn/mailman/listinfo/python-chinese > -- ×îºÃµÄÍƹã±ãÊÇʵ¼ÊÓ¦Óà ×î½üÔÚѧϰweb.py, ¼á³Ö²ÅÄܽø²½ http://del.icio.us/iexper http://twitter.com/qichangxing Gtalk: iexper(at)gmail.com -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071127/bbd4ac1c/attachment.htm
2007年11月27日 星期二 15:45
THX, °´ÕÕÄãµÄ·½·¨, ¸ã¶¨ .. ~ ¸Ðл .! ----- Original Message ----- From: leopay To: python-chinese在lists.python.cn Sent: Tuesday, November 27, 2007 10:26 AM Subject: Re: [python-chinese]djangoÀïÃæ×öÑéÖ¤ÂëÓ¦ÓÃ,³öÁ˵ãСÎÊÌâ! ¹¹Ôì¸öbuf£¬°ÑÉú³ÉµÄͼƬsaveµ½ÀïÃ棬Ȼºó·µ»Øʱָ¶¨httpÍ· buf = cStringIO.StringIO() m.save(buf, 'PNG') return HttpResponse(buf.getvalue(),'image/PNG') On 11/27/07, List <shell.lists在gmail.com> wrote: ÓÃpython+djangoÀ´×ö¸öСÏîÄ¿,¸ãÁ˸öÑéÖ¤Âë,·ÀÖ¹»úÆ÷ÈËÌá½» a.py #!/usr/bin/python #coding=cp936 import Image,ImageDraw,ImageFont from django.http import HttpResponse from django.shortcuts import render_to_response def index(request): m=Image.new('RGB',(50,30),(255,255,255)) d=ImageDraw.Draw(m) ft=ImageFont.truetype("c:\\windows\\Fonts\\simsun.ttc",18) text="123" d.text((5,5),text,fill=(255,0,0),font=ft) return m.show() urlsÀïÃæ: (r'^a/$','a.index') ÏÖÔÚÎÒÓÃhttp://127.0.0.1/a ·ÃÎʵĻ°, Ö±½ÓÓÃͼƬÆ÷´ò¿ªÍ¼Æ¬ÁË. ÎÒµÄÎÊÌâÊÇ: ÎÒÔõô°ÑÕâ¸öͼƬŪµ½HTMLÀïÃæÈ¥ http://127.0.0.1/a"> ÕâÑù¾Í¿ÉÒÔÒýÓÃͼƬÁË.. _______________________________________________ python-chinese Post: send python-chinese在lists.python.cn Subscribe: send subscribe to python-chinese-request在lists.python.cn Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn Detail Info: http://python.cn/mailman/listinfo/python-chinese ------------------------------------------------------------------------------ _______________________________________________ python-chinese Post: send python-chinese在lists.python.cn Subscribe: send subscribe to python-chinese-request在lists.python.cn Unsubscribe: send unsubscribe to python-chinese-request在lists.python.cn Detail Info: http://python.cn/mailman/listinfo/python-chinese -------------- 下一部分 -------------- Ò»¸öHTML¸½¼þ±»ÒƳý... URL: http://python.cn/pipermail/python-chinese/attachments/20071127/ad07982b/attachment-0001.html
Zeuux © 2025
京ICP备05028076号