HEX
Server: Apache
System: Linux pdx1-shared-a1-38 6.6.104-grsec-jammy+ #3 SMP Tue Sep 16 00:28:11 UTC 2025 x86_64
User: mmickelson (3396398)
PHP: 8.1.31
Disabled: NONE
Upload Files
File: //usr/lib/python3/dist-packages/django/core/files/__pycache__/images.cpython-310.pyc
o

3�a	
�@s>dZddlZddlZddlmZGdd�de�Zd	dd�ZdS)
zO
Utility functions for handling images.

Requires Pillow as you might imagine.
�N)�Filec@s0eZdZdZedd��Zedd��Zdd�ZdS)	�	ImageFilez�
    A mixin for use alongside django.core.files.base.File, which provides
    additional features for dealing with images.
    cC�|��dS)Nr��_get_image_dimensions��self�r	�:/usr/lib/python3/dist-packages/django/core/files/images.py�width�zImageFile.widthcCr)N�rrr	r	r
�heightrzImageFile.heightcCs,t|d�s|j}|��t||d�|_|jS)N�_dimensions_cache)�close)�hasattr�closed�open�get_image_dimensionsr)rrr	r	r
rs

zImageFile._get_image_dimensionsN)�__name__�
__module__�__qualname__�__doc__�propertyrrrr	r	r	r
rs

rFc	
Cs4ddlm}|��}t|d�r|}|��}|�d�nt|d�}d}zjd}	|�|�}|s.nOz|�|�Wn.t	j
yR}z|jd�d�rGn�WYd	}~nd	}~wt
j
y[Yn	tycYnw|jrx|jjW|rr|��S|�|�S|d
9}q&W|r�|��dS|�|�dS|r�|��w|�|�w)z�
    Return the (width, height) of an image, given an open file or a path.  Set
    'close' to True to close the file at the end if it is initially in an open
    state.
    r)r�read�rbTir
zError -5N�)NN)�PILr�Parserr�tell�seekrr�feed�zlib�error�args�
startswith�struct�RuntimeError�image�sizer)	�file_or_pathr�PillowImageFile�p�file�file_pos�
chunk_size�data�er	r	r
r!sR


���
���
r)F)rr&r"�django.core.filesrrrr	r	r	r
�<module>s