![](/img/trans.png)
[英]How can i use both easy thumbnails and sorl-thumbnail in the same django projects yet they have the same template tags?
[英]How can I crop to square with Django Easy Thumbnails?
我在我的網站上使用簡單的縮略圖。 它通常工作正常。 但現在我想為 Facebook 創建一個產品提要,圖片需要是 600x600 像素的正方形。
它看起來像這樣:
thumbnailer = get_thumbnailer(v.product.image)
thumbnail_options = {
'crop': '50,0', #tried smart, scale and all kinds of combos
'size': (600, 600)
}
resized_image = thumbnailer.get_thumbnail(thumbnail_options)
問題是我最終總是將一個維度設置為 600px,另一個維度設置為 <600px。 我可以讓它做一些像智能選項一樣的事情,但以一種我得到方形圖像的方式裁剪嗎?
先感謝您!
thumbnailer = get_thumbnailer(v.product.image)
thumbnail_options = {
'crop': 'smart',
'upscale': True,
'size': (600, 600)
}
resized_image = thumbnailer.get_thumbnail(thumbnail_options)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.