本文整理汇总了Python中sorl.thumbnail.engines.pil_engine.Engine.get_image_size方法的典型用法代码示例。如果您正苦于以下问题:Python Engine.get_image_size方法的具体用法?Python Engine.get_image_size怎么用?Python Engine.get_image_size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sorl.thumbnail.engines.pil_engine.Engine
的用法示例。
在下文中一共展示了Engine.get_image_size方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_retina
# 需要导入模块: from sorl.thumbnail.engines.pil_engine import Engine [as 别名]
# 或者: from sorl.thumbnail.engines.pil_engine.Engine import get_image_size [as 别名]
def test_retina(self):
get_thumbnail(self.im, '50x50')
actions = [
# save regular resolution, same as in StorageTestCase
'open: retina.jpg',
'save: test/cache/19/10/1910dc350bbe9ee55fd9d8d3d5e38e19.jpg',
'get_available_name: test/cache/19/10/1910dc350bbe9ee55fd9d8d3d5e38e19.jpg',
'exists: test/cache/19/10/1910dc350bbe9ee55fd9d8d3d5e38e19.jpg',
# save the 1.5x resolution version
'save: test/cache/19/10/[email protected]',
'get_available_name: test/cache/19/10/[email protected]',
'exists: test/cache/19/10/[email protected]',
# save the 2x resolution version
'save: test/cache/19/10/[email protected]',
'get_available_name: test/cache/19/10/[email protected]',
'exists: test/cache/19/10/[email protected]'
]
self.assertEqual(self.log, actions)
with open(pjoin(settings.MEDIA_ROOT, 'test/cache/19/10/[email protected]')) as fp:
engine = PILEngine()
self.assertEqual(engine.get_image_size(engine.get_image(ImageFile(file_=fp))), (75, 75))
示例2: test_retina
# 需要导入模块: from sorl.thumbnail.engines.pil_engine import Engine [as 别名]
# 或者: from sorl.thumbnail.engines.pil_engine.Engine import get_image_size [as 别名]
def test_retina(self):
get_thumbnail(self.image, '50x50')
actions = [
'exists: test/cache/91/bb/91bb06cf9169e4c52132bb113f2d4c0d.jpg',
# save regular resolution, same as in StorageTestCase
'open: retina.jpg',
'save: test/cache/91/bb/91bb06cf9169e4c52132bb113f2d4c0d.jpg',
'get_available_name: test/cache/91/bb/91bb06cf9169e4c52132bb113f2d4c0d.jpg',
'exists: test/cache/91/bb/91bb06cf9169e4c52132bb113f2d4c0d.jpg',
# save the 1.5x resolution version
'save: test/cache/91/bb/[email protected]',
'get_available_name: test/cache/91/bb/[email protected]',
'exists: test/cache/91/bb/[email protected]',
# save the 2x resolution version
'save: test/cache/91/bb/[email protected]',
'get_available_name: test/cache/91/bb/[email protected]',
'exists: test/cache/91/bb/[email protected]'
]
self.assertEqual(self.log, actions)
path = os.path.join(settings.MEDIA_ROOT,
'test/cache/91/bb/[email protected]')
with open(path) as fp:
engine = PILEngine()
self.assertEqual(engine.get_image_size(engine.get_image(ImageFile(file_=fp))), (75, 75))