本文整理汇总了Python中models.Images.filetype方法的典型用法代码示例。如果您正苦于以下问题:Python Images.filetype方法的具体用法?Python Images.filetype怎么用?Python Images.filetype使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类models.Images
的用法示例。
在下文中一共展示了Images.filetype方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: AddImageByUrl
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import filetype [as 别名]
def AddImageByUrl(url,fileName,tag):
result = urlfetch.fetch(url)
if result.status_code == 200:
name = fileName
mtype = result.headers.get('Content-Type', '')
bits = result.content
gf=GaeFile()
gf.open(name,mtype);
gf.write(bits)
id=gf.close()
image=Images(description="/media/?key="+str(id))
image.mime=result.headers.get('Content-Type', '')
image.filetype=image.mime
# if image.mime.find('image')==-1:
# return None
image.size=len(bits)
image.width=-1;
image.height=-1;
# image.name=fileName
# image.filetype,image.width,image.height=getImageInfo(image.bf)
image.tag=tag.split(',')
image.put()
AddTags(image.tag)
return image
else:
return None
示例2: addImage
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import filetype [as 别名]
def addImage(mime,description,bf,name):
'Add Image'
image=Images(mime=mime,description=description,bf=bf,name=name)
image.size=len(image.bf)
image.filetype,image.width,image.height=getImageInfo(bf)
image.put()
return image
示例3: addImage2
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import filetype [as 别名]
def addImage2(bf):
image=Images(bf=bf)
image.size=len(bf)
image.filetype,image.width,image.height=getImageInfo(bf)
if not image.filetype:return None
image.mime=image.filetype
image.put()
return image
示例4: addImage
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import filetype [as 别名]
def addImage(name, mime,description,tag,bf):
'Add Image'
image=Images(name=name, mime=mime,description=description,tag=tag.split(','), bf=bf)
image.size=len(image.bf)
image.filetype,image.width,image.height=getImageInfo(bf)
image.put()
AddTags(image.tag)
return image
示例5: addImage
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import filetype [as 别名]
def addImage(title,bf,referer):
'Add Image'
image=Images(description=title,bf=bf,referer=referer)
image.size=len(image.bf)
image.filetype,image.width,image.height=getImageInfo(bf)
if not image.filetype:return None
image.mime=image.filetype
image.put()
return image
示例6: addImage
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import filetype [as 别名]
def addImage(mime,description,bf):
'Add Image'
image=Images(mime=mime,description=description)
image.size=len(image.bf)
image.filetype,image.width,image.height=getImageInfo(bf)
image.put()
imageblob = ImageBlob(image=image, bf=bf)
imageblob.put()
prependToRSS([image])
return image
示例7: addImage2
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import filetype [as 别名]
def addImage2(bf):
image=Images()
image.size=len(bf)
image.filetype,image.width,image.height=getImageInfo(bf)
if not image.filetype:return None
image.mime=image.filetype
image.put()
imageblob = ImageBlob(image=image, bf=bf)
imageblob.put()
prependToRSS([image])
return image
示例8: AddImageByUrlBak
# 需要导入模块: from models import Images [as 别名]
# 或者: from models.Images import filetype [as 别名]
def AddImageByUrlBak(url,fileName,tag):
result = urlfetch.fetch(url)
if result.status_code == 200:
image=Images(description=url,bf=result.content)
image.mime=result.headers.get('Content-Type', '')
if image.mime.find('image')==-1:
return None
image.size=len(image.bf)
image.name=fileName
image.filetype,image.width,image.height=getImageInfo(image.bf)
image.tag=tag.split(',')
image.put()
AddTags(image.tag)
return image
else:
return None