kopia lustrzana https://github.com/wagtail/wagtail
Wand image backend: Always clone images before performing oprations on them
rodzic
d88a5e596b
commit
351b74c94b
|
@ -18,8 +18,9 @@ class WandBackend(BaseImageBackend):
|
|||
image.save(file=output)
|
||||
|
||||
def resize(self, image, size):
|
||||
image.resize(size[0], size[1])
|
||||
return image
|
||||
new_image = image.clone()
|
||||
new_image.resize(size[0], size[1])
|
||||
return new_image
|
||||
|
||||
def crop_to_centre(self, image, size):
|
||||
(original_width, original_height) = image.size
|
||||
|
@ -34,7 +35,9 @@ class WandBackend(BaseImageBackend):
|
|||
|
||||
left = (original_width - final_width) / 2
|
||||
top = (original_height - final_height) / 2
|
||||
image.crop(
|
||||
|
||||
new_image = image.clone()
|
||||
new_image.crop(
|
||||
left=left, top=top, right=left + final_width, bottom=top + final_height
|
||||
)
|
||||
return image
|
||||
return new_image
|
||||
|
|
Ładowanie…
Reference in New Issue