當前位置: 首頁>>代碼示例>>Python>>正文


Python File.get_thumbnail_url方法代碼示例

本文整理匯總了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)
開發者ID:gokure,項目名稱:python-sdk,代碼行數:10,代碼來源:test_file.py

示例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)
開發者ID:lord63-forks,項目名稱:python-sdk,代碼行數:11,代碼來源:test_file.py

示例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')
開發者ID:gokure,項目名稱:python-sdk,代碼行數:10,代碼來源:test_file.py

示例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')
開發者ID:lord63-forks,項目名稱:python-sdk,代碼行數:11,代碼來源:test_file.py

示例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
開發者ID:LiuYiLe,項目名稱:iclass,代碼行數:20,代碼來源:profile.py


注:本文中的leancloud.File.get_thumbnail_url方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。