示例#1
0
    def test_load_resized_image(self):
        root_folder = getattr(settings, "PHOTOS_ROOT_DIR", "/")
        photo = Photo(root_folder, "album2", "photo_first.JPG")
        img = Image.open(photo.real_filename)
        self.assertEquals(img.size[0], 3008)

        cache = PhotoCache(photo)

        self._remove_cache(cache.get_filename())
        self.assertFalse(cache.is_in_cache())

        cache.set_max_dimension(800)
        cache_file = cache.get_file()

        img = Image.open(cache_file)
        size = img.size
        self.assertEquals(size[0], 800)
示例#2
0
    def test_load_resized_image(self):
        root_folder = getattr(settings, 'PHOTOS_ROOT_DIR', '/')
        photo = Photo(root_folder, "album2", 'photo_first.JPG')
        img = Image.open(photo.real_filename)
        self.assertEquals(img.size[0], 3008)

        cache = PhotoCache(photo)

        self._remove_cache(cache.get_filename())
        self.assertFalse(cache.is_in_cache())

        cache.set_max_dimension(800)
        cache_file = cache.get_file()

        img = Image.open(cache_file)
        size = img.size
        self.assertEquals(size[0], 800)