本文整理匯總了Python中leancloud.File.get_thumbnail_url方法的典型用法代碼示例。如果您正苦於以下問題:Python File.get_thumbnail_url方法的具體用法?Python File.get_thumbnail_url怎麽用?Python File.get_thumbnail_url使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類leancloud.File
的用法示例。
在下文中一共展示了File.get_thumbnail_url方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: test_thumbnail_size_erorr
# 需要導入模塊: from leancloud import File [as 別名]
# 或者: from leancloud.File import get_thumbnail_url [as 別名]
def test_thumbnail_size_erorr():
r = requests.get('http://www.lenna.org/full/len_std.jpg')
f = File('Lenna2.jpg', r.content)
f.save()
assert f.id
f.get_thumbnail_url(-1, -1)
f.get_thumbnail_url(1, 1, quality=110)
示例2: test_thumbnail_size_erorr
# 需要導入模塊: from leancloud import File [as 別名]
# 或者: from leancloud.File import get_thumbnail_url [as 別名]
def test_thumbnail_size_erorr():
r = requests.get('http://i1.wp.com/leancloud.cn/images/static/default-avatar.png')
b = buffer(r.content)
f = File('Lenna2.jpg', b)
f.save()
assert f.id
f.get_thumbnail_url(-1, -1)
f.get_thumbnail_url(1, 1, quality=110)
示例3: test_thumbnail
# 需要導入模塊: from leancloud import File [as 別名]
# 或者: from leancloud.File import get_thumbnail_url [as 別名]
def test_thumbnail():
r = requests.get('http://www.lenna.org/full/len_std.jpg')
f = File('Lenna2.jpg', r.content)
f.save()
assert f.id
url = f.get_thumbnail_url(100, 100)
assert url.endswith('?imageView/2/w/100/h/100/q/100/format/png')
示例4: test_thumbnail
# 需要導入模塊: from leancloud import File [as 別名]
# 或者: from leancloud.File import get_thumbnail_url [as 別名]
def test_thumbnail():
r = requests.get('http://i1.wp.com/leancloud.cn/images/static/default-avatar.png')
b = buffer(r.content)
f = File('Lenna2.jpg', b)
f.save()
assert f.id
url = f.get_thumbnail_url(100, 100)
assert url.endswith('?imageView/2/w/100/h/100/q/100/format/png')
示例5: post
# 需要導入模塊: from leancloud import File [as 別名]
# 或者: from leancloud.File import get_thumbnail_url [as 別名]
def post(self, username):
profile_fields = ['realName', 'gender', 'school', 'grade', 'major', 'about']
userProfile = Query(UserProfile).equal_to("user", username).first()
try:
for key in profile_fields:
userProfile.set(key, self.get_argument(key, ""))
if 'file' in self.request.files:
file_dict_list = self.request.files['file']
for file_dict in file_dict_list:
data = file_dict["body"]
avatar = File("avatar", buffer(data))
avatar.save()
userProfile.set("avatar", avatar.get_thumbnail_url(width='200', height='200'))
userProfile.save()
self.redirect('/user/'+username)
print self.request
except LeanCloudError, e:
pass