|
Server : Apache System : Linux cvar2.toservers.com 3.10.0-962.3.2.lve1.5.73.el7.x86_64 #1 SMP Wed Aug 24 21:31:23 UTC 2022 x86_64 User : njnconst ( 1116) PHP Version : 8.4.18 Disable Function : NONE Directory : /usr/lib64/python2.7/site-packages/django/core/files/ |
Upload File : |
�
r�\c @ sH d Z d d l Z d d l m Z d e f d � � YZ e d � Z d S( sY
Utility functions for handling images.
Requires Pillow (or PIL), as you might imagine.
i����N( t Filet ImageFilec B sA e Z d Z d � Z e e � Z d � Z e e � Z d � Z RS( s�
A mixin for use alongside django.core.files.base.File, which provides
additional features for dealing with images.
c C s | j � d S( Ni ( t _get_image_dimensions( t self( ( s: /tmp/pip-install-XxeQeY/django/django/core/files/images.pyt
_get_width s c C s | j � d S( Ni ( R ( R ( ( s: /tmp/pip-install-XxeQeY/django/django/core/files/images.pyt _get_height s c C sA t | d � s: | j } | j � t | d | �| _ n | j S( Nt _dimensions_cachet close( t hasattrt closedt opent get_image_dimensionsR ( R R ( ( s: /tmp/pip-install-XxeQeY/django/django/core/files/images.pyR s
( t __name__t
__module__t __doc__R t propertyt widthR t heightR ( ( ( s: /tmp/pip-install-XxeQeY/django/django/core/files/images.pyR s c C s d d l m } | j � } t | d � rM | } | j � } | j d � n t | d � } t } z� d } x | j | � } | s� Pn y | j | � Wn2 t
j k
r� } | j d j
d � r� q� � n X| j r� | j j S| d } qn d SWd | r| j � n
| j | � Xd S(
s�
Returns 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.
i����( R t readi t rbi s Error -5i N( t django.utils.imageR t ParserR t tellt seekR
t TrueR t feedt zlibt errort argst
startswitht imaget sizet NoneR ( t file_or_pathR t PILImageFilet pt filet file_post
chunk_sizet datat e( ( s: /tmp/pip-install-XxeQeY/django/django/core/files/images.pyR s6
( R R t django.core.filesR R t FalseR ( ( ( s: /tmp/pip-install-XxeQeY/django/django/core/files/images.pyt <module> s