コード例 #1
0
ファイル: images.py プロジェクト: imfht/flaskapps
 def open(self):
     if self.file.startswith('http'):
         return requests.get(self.file, stream=True).raw
     elif self.file.startswith(r'data:image/'):
         return BytesIO(
             base64.b64decode(
                 self.file.replace('data:image/jpeg;base64,', '')))
     return get_storage_backend().open(self.file)
コード例 #2
0
ファイル: test_helpers.py プロジェクト: imfht/flaskapps
 def test_get_storage_backend(self):
     if has_django():
         self.assertIsInstance(get_storage_backend(), DjangoStorageBackend)
     else:
         self.assertIsInstance(get_storage_backend(),
                               FilesystemStorageBackend)
コード例 #3
0
ファイル: images.py プロジェクト: imfht/flaskapps
 def save_alternative_resolution(self, resolution, image, options):
     path = self.alternative_resolution_path(resolution)
     return get_storage_backend().save(
         path,
         get_engine().raw_data(image, options))
コード例 #4
0
ファイル: images.py プロジェクト: imfht/flaskapps
 def exists(self):
     return get_storage_backend().exists(self.path)
コード例 #5
0
ファイル: images.py プロジェクト: imfht/flaskapps
 def save(self, options):
     return get_storage_backend().save(
         self.path,
         get_engine().raw_data(self.image, options))
コード例 #6
0
ファイル: images.py プロジェクト: assad2012/python-thumbnails
 def open(self):
     if self.file.startswith('http'):
         return requests.get(self.file, stream=True).raw
     elif self.file.startswith(r'data:image/'):
         return BytesIO(base64.b64decode(self.file.replace('data:image/jpeg;base64,', '')))
     return get_storage_backend().open(self.file)
コード例 #7
0
ファイル: images.py プロジェクト: assad2012/python-thumbnails
 def save_alternative_resolution(self, resolution, image, options):
     path = self.alternative_resolution_path(resolution)
     return get_storage_backend().save(path, get_engine().raw_data(image, options))
コード例 #8
0
ファイル: images.py プロジェクト: assad2012/python-thumbnails
 def save(self, options):
     return get_storage_backend().save(self.path, get_engine().raw_data(self.image, options))
コード例 #9
0
ファイル: images.py プロジェクト: assad2012/python-thumbnails
 def exists(self):
     return get_storage_backend().exists(self.path)
コード例 #10
0
 def test_get_storage_backend(self):
     if has_django():
         self.assertIsInstance(get_storage_backend(), DjangoStorageBackend)
     else:
         self.assertIsInstance(get_storage_backend(), FilesystemStorageBackend)