Determine which resized Imgur filename to use based on the display width/height. Includes the extension.

        :param str display_width: Display width from Sphinx directive options (e.g. '100px', '50%').
        :param str display_height: Display height from Sphinx directive options (e.g. '100px', '50%').
        :param bool full_size: Always return the original full size image filename.

        :return: The filename to use in <img src="...">.
        :rtype: str

def filename(self, display_width='', display_height='', full_size=False):
        """Determine which resized Imgur filename to use based on the display width/height. Includes the extension.

        :param str display_width: Display width from Sphinx directive options (e.g. '100px', '50%').
        :param str display_height: Display height from Sphinx directive options (e.g. '100px', '50%').
        :param bool full_size: Always return the original full size image filename.

        :return: The filename to use in <img src="...">.
        :rtype: str
        """
        extension = self.type[-3:] if self.type in ('image/png', 'image/gif') else 'jpg'
        if extension == 'gif' or full_size:
            return '{}.{}'.format(self.imgur_id, extension)  # Imgur doesn't animate resized versions.
        size = 'h'  # Default is 'huge' since all Sphinx themes limit document width to < 1024px.
        if (not display_width and not display_height) or not self.width or not self.height:
            return '{}{}.{}'.format(self.imgur_id, size, extension)

        # Parse display_width and display_height.
        if display_width.endswith('px'):
            width = int(display_width[:-2])
        elif display_width.endswith('%'):
            width = self.width * (int(display_width[:-1]) / 100.0)
        elif display_height.endswith('px'):
            width = (self.width * int(display_height[:-2])) / self.height
        else:
            width = self.width

        # Determine size.
        if width <= 160:
            size = 't'
        elif width <= 320:
            size = 'm'
        elif width <= 640:
            size = 'l'
        return '{}{}.{}'.format(self.imgur_id, size, extension)