簡體   English   中英

生成了額外的別名縮略圖

[英]Extra alias thumbnail generated

我在此 model(簡化版)中使用簡單縮略圖圖像裁剪應用程序和別名:

from image_cropping import ImageRatioField
from easy_thumbnails.fields import ThumbnailerImageField

class Image(SlugMixin, models.Model):
    slug_from_field = 'title'
    slug_length = 110

    image = ThumbnailerImageField('path', upload_to=get_file_name,
                                  resize_source=dict(
                                      size=(1600, 0), quality=95),
                                  width_field='width', height_field='height',
                                  blank=True, null=True)
    crop_thumb = ImageRatioField(
      'image', '120x90',
      help_text='Drag the handles and crop area to crop the image.',
      verbose_name="crop thumbnail")
    crop_image = ImageRatioField(
      'image', '400x300',
      free_crop=True,
      help_text='Drag the handles and crop area to crop the image.')
    ....

settings.py 中的別名定義:

THUMBNAIL_ALIASES = {
    '': {
        'small': {
            'size': (120, 90), 'detail': True, 'crop': True, 'upscale': True,
            'ALIAS': 'small', 'ratio_field': 'crop_thumb',
        },
        'medium': {
            'size': (240, 180), 'detail': True, 'crop': True, 'upscale': True,
            'ALIAS': 'medium', 'ratio_field': 'crop_thumb',
        },
        'large': {
            'size': (0, 400), 'quality': 90, 'detail': True, 'upscale': True,
            'ALIAS': 'large', 'ratio_field': 'crop_image',
        },
    },
}

THUMBNAIL_NAMER = 'easy_thumbnails.namers.alias'

我預計每張上傳的圖像會得到 3 個縮略圖,但我得到了 4 個。預期的 3 個被命名為 my_image.jpg.small.jpg + medium 和 large,另外一個是 my_image.jpg..jpg 並且是 300px 寬。
就像它為空別名生成一個額外的縮略圖,但我在我的代碼中找不到任何可以做到這一點的東西。
任何想法?

好的,我想我找到了答案。 圖片裁剪應用需要創建縮略圖,以允許用戶在后台調整裁剪區域並動態創建; 它僅在用戶與管理員交互時生成,這就是我的情況。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM