def get_image_dimension(self, url):
w_h = (None, None)<EOL>try:<EOL><INDENT>if url.startswith('<STR_LIT>'):<EOL><INDENT>url = '<STR_LIT>' + url<EOL><DEDENT>data = requests.get(url).content<EOL>im = Image.open(BytesIO(data))<EOL>w_h = im.size<EOL><DEDENT>except Exception:<EOL><INDENT>logger.warning("<STR_LIT>".format(url), exc_info=True)<EOL><DEDENT>return w_h<EOL>
Return a tuple that contains (width, height)
Pass in a url to an image and find out its size without loading the whole file
If the image wxh could not be found, the tuple will contain `None` values