o
    ÿ‚¢RG  ã                   @   sX   d dl Z d dlmZ d dlmZ d dlmZ d dlmZ d dl	m
Z
 G dd„ deƒZdS )	é    N)Úsettings)ÚNoArgsCommand)Úget_image_files)Úget_thumb_filename)Úget_backendc                   @   s   e Zd ZdZdd„ ZdS )ÚCommandzŠ
    Creates thumbnail files for the CKEditor file image browser.
    Useful if starting to use django-ckeditor with existing images.
    c                 K   s¨   t tdd ƒrLtƒ }tƒ D ]7}tj t|ƒ¡sC| j 	d 
|¡¡ z| |¡ W q tyB } z| j 	d 
||¡¡ W Y d }~qd }~ww q| j 	d¡ d S | j 	d¡ d S )NÚCKEDITOR_IMAGE_BACKENDzCreating thumbnail for {0}z&Couldn't create thumbnail for {0}: {1}ÚFinishedzNo thumbnail backend is enabled)Úgetattrr   r   r   ÚosÚpathÚisfiler   ÚstdoutÚwriteÚformatÚcreate_thumbnailÚ	Exception)ÚselfÚoptionsÚbackendÚimageÚe© r   ún/var/www/html/kck/venv/lib/python3.10/site-packages/ckeditor/management/commands/generateckeditorthumbnails.pyÚhandle_noargs   s   
 €ÿüzCommand.handle_noargsN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r      s    r   )r   Údjango.confr   Údjango.core.management.baser   Úckeditor.viewsr   Úckeditor.utilsr   Úckeditor.image_processingr   r   r   r   r   r   Ú<module>   s    