We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Support src urls and alt texts on Images
#### My Pain

I would like to use images in Panel via `pn.pane.Markdown` and/ or `pn.pane.PNG`.

Currently the Bokeh layout engine does not layout markdown with images well. See https://github.com/holoviz/panel/issues/835.

So I need to stick to `pn.pane.PNG` for images.

But the `ImageBase` class does not support parameters like the `src` url and `alt` text from the the HTML `img` tag. So I cannot provide image links or alt texts.

#### Solution

Add `src` and `alt` parameters to the `BaseImage` class.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `panel/pane/image.py`
Content:
```
1 """
2 Contains Image panes including renderers for PNG, SVG, GIF and JPG
3 file types.
4 """
5 from __future__ import absolute_import, division, unicode_literals
6 
7 import base64
8 
9 from io import BytesIO
10 from six import string_types
11 
12 import param
13 
14 from .markup import escape, DivPaneBase
15 from ..util import isfile, isurl
16 
17 
18 class ImageBase(DivPaneBase):
19     """
20     Encodes an image as base64 and wraps it in a Bokeh Div model.
21     This is an abstract base class that needs the image type
22     to be specified and specific code for determining the image shape.
23 
24     The imgtype determines the filetype, extension, and MIME type for
25     this image. Each image type (png,jpg,gif) has a base class that
26     supports anything with a `_repr_X_` method (where X is `png`,
27     `gif`, etc.), a local file with the given file extension, or a
28     HTTP(S) url with the given extension.  Subclasses of each type can
29     provide their own way of obtaining or generating a PNG.
30     """
31 
32     alt_text = param.String(default=None, doc="""
33        alt text to add to the image tag. The alt text is shown when a
34        user cannot load or display the image.""")
35 
36     link_url = param.String(default=None, doc="""
37        A link URL to make the image clickable and link to some other
38        website.""")
39 
40     embed = param.Boolean(default=True, doc="""
41         Whether to embed the image as base64.""")
42 
43     imgtype = 'None'
44 
45     _rerender_params = ['alt_text', 'link_url', 'embed', 'object', 'style']
46 
47     _target_transforms = {'object': """'<img src="' + value + '"></img>'"""}
48 
49     __abstract = True
50 
51     @classmethod
52     def applies(cls, obj):
53         imgtype = cls.imgtype
54         if hasattr(obj, '_repr_{}_'.format(imgtype)):
55             return True
56         if isinstance(obj, string_types):
57             if isfile(obj) and obj.endswith('.'+imgtype):
58                 return True
59             if isurl(obj, [cls.imgtype]):
60                 return True
61         if hasattr(obj, 'read'):  # Check for file like object
62             return True
63         return False
64 
65     def _type_error(self, object):
66         if isinstance(object, string_types):
67             raise ValueError("%s pane cannot parse string that is not a filename "
68                              "or URL." % type(self).__name__)
69         super(ImageBase, self)._type_error(object)
70 
71     def _img(self):
72         if hasattr(self.object, '_repr_{}_'.format(self.imgtype)):
73             return getattr(self.object, '_repr_' + self.imgtype + '_')()
74         if isinstance(self.object, string_types):
75             if isfile(self.object):
76                 with open(self.object, 'rb') as f:
77                     return f.read()
78         if hasattr(self.object, 'read'):
79             return self.object.read()
80         if isurl(self.object, [self.imgtype]):
81             import requests
82             r = requests.request(url=self.object, method='GET')
83             return r.content
84 
85     def _imgshape(self, data):
86         """Calculate and return image width,height"""
87         raise NotImplementedError
88 
89     def _get_properties(self):
90         p = super(ImageBase, self)._get_properties()
91         if self.object is None:
92             return dict(p, text='<img></img>')
93         data = self._img()
94         if not isinstance(data, bytes):
95             data = base64.b64decode(data)
96         width, height = self._imgshape(data)
97         if self.width is not None:
98             if self.height is None:
99                 height = int((self.width/width)*height)
100             else:
101                 height = self.height
102             width = self.width
103         elif self.height is not None:
104             width = int((self.height/height)*width)
105             height = self.height
106         if not self.embed:
107             src = self.object
108         else:
109             b64 = base64.b64encode(data).decode("utf-8")
110             src = "data:image/"+self.imgtype+";base64,{b64}".format(b64=b64)
111 
112         smode = self.sizing_mode
113         if smode in ['fixed', None]:
114             w, h = '%spx' % width, '%spx' % height
115         elif smode == 'stretch_both':
116             w, h = '100%', '100%'
117         elif smode == 'stretch_height':
118             w, h = '%spx' % width, '100%'
119         elif smode == 'stretch_height':
120             w, h = '100%', '%spx' % height
121         elif smode == 'scale_height':
122             w, h = 'auto', '100%'
123         else:
124             w, h = '100%', 'auto'
125 
126         html = '<img src="{src}" width="{width}" height="{height}" alt="{alt}"></img>'.format(
127             src=src, width=w, height=h, alt=self.alt_text or '')
128 
129         if self.link_url:
130             html = '<a href="{url}" target="_blank">{html}</a>'.format(
131                 url=self.link_url, html=html)
132 
133         return dict(p, width=width, height=height, text=escape(html))
134 
135 
136 class PNG(ImageBase):
137 
138     imgtype = 'png'
139 
140     @classmethod
141     def _imgshape(cls, data):
142         import struct
143         w, h = struct.unpack('>LL', data[16:24])
144         return int(w), int(h)
145 
146 
147 class GIF(ImageBase):
148 
149     imgtype = 'gif'
150 
151     @classmethod
152     def _imgshape(cls, data):
153         import struct
154         w, h = struct.unpack("<HH", data[6:10])
155         return int(w), int(h)
156 
157 
158 class JPG(ImageBase):
159 
160     imgtype = 'jpg'
161 
162     @classmethod
163     def _imgshape(cls, data):
164         import struct
165         b = BytesIO(data)
166         b.read(2)
167         c = b.read(1)
168         while (c and ord(c) != 0xDA):
169             while (ord(c) != 0xFF): c = b.read(1)
170             while (ord(c) == 0xFF): c = b.read(1)
171             if (ord(c) >= 0xC0 and ord(c) <= 0xC3):
172                 b.read(3)
173                 h, w = struct.unpack(">HH", b.read(4))
174                 break
175             else:
176                 b.read(int(struct.unpack(">H", b.read(2))[0])-2)
177             c = b.read(1)
178         return int(w), int(h)
179 
180 
181 class SVG(ImageBase):
182 
183     encode = param.Boolean(default=False, doc="""
184         Whether to enable base64 encoding of the SVG, base64 encoded
185         SVGs do not support links.""")
186 
187     imgtype = 'svg'
188 
189     _rerender_params = ImageBase._rerender_params + ['encode']
190 
191     @classmethod
192     def applies(cls, obj):
193         return (super(SVG, cls).applies(obj) or
194                 (isinstance(obj, string_types) and obj.lstrip().startswith('<svg')))
195 
196     def _type_error(self, object):
197         if isinstance(object, string_types):
198             raise ValueError("%s pane cannot parse string that is not a filename, "
199                              "URL or a SVG XML contents." % type(self).__name__)
200         super(SVG, self)._type_error(object)
201 
202     def _img(self):
203         if (isinstance(self.object, string_types) and
204             self.object.lstrip().startswith('<svg')):
205             return self.object
206         return super(SVG, self)._img()
207 
208     def _imgshape(self, data):
209         return (self.width, self.height)
210 
211     def _get_properties(self):
212         p = super(ImageBase, self)._get_properties()
213         if self.object is None:
214             return dict(p, text='<img></img>')
215         data = self._img()
216         width, height = self._imgshape(data)
217         if not isinstance(data, bytes):
218             data = data.encode('utf-8')
219 
220         if self.encode:
221             b64 = base64.b64encode(data).decode("utf-8")
222             src = "data:image/svg+xml;base64,{b64}".format(b64=b64)
223             html = "<img src='{src}' width={width} height={height}></img>".format(
224                 src=src, width=width, height=height
225             )
226         else:
227             html = data.decode("utf-8")
228         return dict(p, width=width, height=height, text=escape(html))
229
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/panel/pane/image.py b/panel/pane/image.py
--- a/panel/pane/image.py
+++ b/panel/pane/image.py
@@ -114,7 +114,7 @@
             w, h = '%spx' % width, '%spx' % height
         elif smode == 'stretch_both':
             w, h = '100%', '100%'
-        elif smode == 'stretch_height':
+        elif smode == 'stretch_width':
             w, h = '%spx' % width, '100%'
         elif smode == 'stretch_height':
             w, h = '100%', '%spx' % height

{"golden_diff": "diff --git a/panel/pane/image.py b/panel/pane/image.py\n--- a/panel/pane/image.py\n+++ b/panel/pane/image.py\n@@ -114,7 +114,7 @@\n             w, h = '%spx' % width, '%spx' % height\n         elif smode == 'stretch_both':\n             w, h = '100%', '100%'\n-        elif smode == 'stretch_height':\n+        elif smode == 'stretch_width':\n             w, h = '%spx' % width, '100%'\n         elif smode == 'stretch_height':\n             w, h = '100%', '%spx' % height\n", "issue": "Support src urls and alt texts on Images\n#### My Pain\r\n\r\nI would like to use images in Panel via `pn.pane.Markdown` and/ or `pn.pane.PNG`.\r\n\r\nCurrently the Bokeh layout engine does not layout markdown with images well. See https://github.com/holoviz/panel/issues/835.\r\n\r\nSo I need to stick to `pn.pane.PNG` for images.\r\n\r\nBut the `ImageBase` class does not support parameters like the `src` url and `alt` text from the the HTML `img` tag. So I cannot provide image links or alt texts.\r\n\r\n#### Solution\r\n\r\nAdd `src` and `alt` parameters to the `BaseImage` class.\n", "before_files": [{"content": "\"\"\"\nContains Image panes including renderers for PNG, SVG, GIF and JPG\nfile types.\n\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n\nimport base64\n\nfrom io import BytesIO\nfrom six import string_types\n\nimport param\n\nfrom .markup import escape, DivPaneBase\nfrom ..util import isfile, isurl\n\n\nclass ImageBase(DivPaneBase):\n    \"\"\"\n    Encodes an image as base64 and wraps it in a Bokeh Div model.\n    This is an abstract base class that needs the image type\n    to be specified and specific code for determining the image shape.\n\n    The imgtype determines the filetype, extension, and MIME type for\n    this image. Each image type (png,jpg,gif) has a base class that\n    supports anything with a `_repr_X_` method (where X is `png`,\n    `gif`, etc.), a local file with the given file extension, or a\n    HTTP(S) url with the given extension.  Subclasses of each type can\n    provide their own way of obtaining or generating a PNG.\n    \"\"\"\n\n    alt_text = param.String(default=None, doc=\"\"\"\n       alt text to add to the image tag. The alt text is shown when a\n       user cannot load or display the image.\"\"\")\n\n    link_url = param.String(default=None, doc=\"\"\"\n       A link URL to make the image clickable and link to some other\n       website.\"\"\")\n\n    embed = param.Boolean(default=True, doc=\"\"\"\n        Whether to embed the image as base64.\"\"\")\n\n    imgtype = 'None'\n\n    _rerender_params = ['alt_text', 'link_url', 'embed', 'object', 'style']\n\n    _target_transforms = {'object': \"\"\"'<img src=\"' + value + '\"></img>'\"\"\"}\n\n    __abstract = True\n\n    @classmethod\n    def applies(cls, obj):\n        imgtype = cls.imgtype\n        if hasattr(obj, '_repr_{}_'.format(imgtype)):\n            return True\n        if isinstance(obj, string_types):\n            if isfile(obj) and obj.endswith('.'+imgtype):\n                return True\n            if isurl(obj, [cls.imgtype]):\n                return True\n        if hasattr(obj, 'read'):  # Check for file like object\n            return True\n        return False\n\n    def _type_error(self, object):\n        if isinstance(object, string_types):\n            raise ValueError(\"%s pane cannot parse string that is not a filename \"\n                             \"or URL.\" % type(self).__name__)\n        super(ImageBase, self)._type_error(object)\n\n    def _img(self):\n        if hasattr(self.object, '_repr_{}_'.format(self.imgtype)):\n            return getattr(self.object, '_repr_' + self.imgtype + '_')()\n        if isinstance(self.object, string_types):\n            if isfile(self.object):\n                with open(self.object, 'rb') as f:\n                    return f.read()\n        if hasattr(self.object, 'read'):\n            return self.object.read()\n        if isurl(self.object, [self.imgtype]):\n            import requests\n            r = requests.request(url=self.object, method='GET')\n            return r.content\n\n    def _imgshape(self, data):\n        \"\"\"Calculate and return image width,height\"\"\"\n        raise NotImplementedError\n\n    def _get_properties(self):\n        p = super(ImageBase, self)._get_properties()\n        if self.object is None:\n            return dict(p, text='<img></img>')\n        data = self._img()\n        if not isinstance(data, bytes):\n            data = base64.b64decode(data)\n        width, height = self._imgshape(data)\n        if self.width is not None:\n            if self.height is None:\n                height = int((self.width/width)*height)\n            else:\n                height = self.height\n            width = self.width\n        elif self.height is not None:\n            width = int((self.height/height)*width)\n            height = self.height\n        if not self.embed:\n            src = self.object\n        else:\n            b64 = base64.b64encode(data).decode(\"utf-8\")\n            src = \"data:image/\"+self.imgtype+\";base64,{b64}\".format(b64=b64)\n\n        smode = self.sizing_mode\n        if smode in ['fixed', None]:\n            w, h = '%spx' % width, '%spx' % height\n        elif smode == 'stretch_both':\n            w, h = '100%', '100%'\n        elif smode == 'stretch_height':\n            w, h = '%spx' % width, '100%'\n        elif smode == 'stretch_height':\n            w, h = '100%', '%spx' % height\n        elif smode == 'scale_height':\n            w, h = 'auto', '100%'\n        else:\n            w, h = '100%', 'auto'\n\n        html = '<img src=\"{src}\" width=\"{width}\" height=\"{height}\" alt=\"{alt}\"></img>'.format(\n            src=src, width=w, height=h, alt=self.alt_text or '')\n\n        if self.link_url:\n            html = '<a href=\"{url}\" target=\"_blank\">{html}</a>'.format(\n                url=self.link_url, html=html)\n\n        return dict(p, width=width, height=height, text=escape(html))\n\n\nclass PNG(ImageBase):\n\n    imgtype = 'png'\n\n    @classmethod\n    def _imgshape(cls, data):\n        import struct\n        w, h = struct.unpack('>LL', data[16:24])\n        return int(w), int(h)\n\n\nclass GIF(ImageBase):\n\n    imgtype = 'gif'\n\n    @classmethod\n    def _imgshape(cls, data):\n        import struct\n        w, h = struct.unpack(\"<HH\", data[6:10])\n        return int(w), int(h)\n\n\nclass JPG(ImageBase):\n\n    imgtype = 'jpg'\n\n    @classmethod\n    def _imgshape(cls, data):\n        import struct\n        b = BytesIO(data)\n        b.read(2)\n        c = b.read(1)\n        while (c and ord(c) != 0xDA):\n            while (ord(c) != 0xFF): c = b.read(1)\n            while (ord(c) == 0xFF): c = b.read(1)\n            if (ord(c) >= 0xC0 and ord(c) <= 0xC3):\n                b.read(3)\n                h, w = struct.unpack(\">HH\", b.read(4))\n                break\n            else:\n                b.read(int(struct.unpack(\">H\", b.read(2))[0])-2)\n            c = b.read(1)\n        return int(w), int(h)\n\n\nclass SVG(ImageBase):\n\n    encode = param.Boolean(default=False, doc=\"\"\"\n        Whether to enable base64 encoding of the SVG, base64 encoded\n        SVGs do not support links.\"\"\")\n\n    imgtype = 'svg'\n\n    _rerender_params = ImageBase._rerender_params + ['encode']\n\n    @classmethod\n    def applies(cls, obj):\n        return (super(SVG, cls).applies(obj) or\n                (isinstance(obj, string_types) and obj.lstrip().startswith('<svg')))\n\n    def _type_error(self, object):\n        if isinstance(object, string_types):\n            raise ValueError(\"%s pane cannot parse string that is not a filename, \"\n                             \"URL or a SVG XML contents.\" % type(self).__name__)\n        super(SVG, self)._type_error(object)\n\n    def _img(self):\n        if (isinstance(self.object, string_types) and\n            self.object.lstrip().startswith('<svg')):\n            return self.object\n        return super(SVG, self)._img()\n\n    def _imgshape(self, data):\n        return (self.width, self.height)\n\n    def _get_properties(self):\n        p = super(ImageBase, self)._get_properties()\n        if self.object is None:\n            return dict(p, text='<img></img>')\n        data = self._img()\n        width, height = self._imgshape(data)\n        if not isinstance(data, bytes):\n            data = data.encode('utf-8')\n\n        if self.encode:\n            b64 = base64.b64encode(data).decode(\"utf-8\")\n            src = \"data:image/svg+xml;base64,{b64}\".format(b64=b64)\n            html = \"<img src='{src}' width={width} height={height}></img>\".format(\n                src=src, width=width, height=height\n            )\n        else:\n            html = data.decode(\"utf-8\")\n        return dict(p, width=width, height=height, text=escape(html))\n", "path": "panel/pane/image.py"}], "after_files": [{"content": "\"\"\"\nContains Image panes including renderers for PNG, SVG, GIF and JPG\nfile types.\n\"\"\"\nfrom __future__ import absolute_import, division, unicode_literals\n\nimport base64\n\nfrom io import BytesIO\nfrom six import string_types\n\nimport param\n\nfrom .markup import escape, DivPaneBase\nfrom ..util import isfile, isurl\n\n\nclass ImageBase(DivPaneBase):\n    \"\"\"\n    Encodes an image as base64 and wraps it in a Bokeh Div model.\n    This is an abstract base class that needs the image type\n    to be specified and specific code for determining the image shape.\n\n    The imgtype determines the filetype, extension, and MIME type for\n    this image. Each image type (png,jpg,gif) has a base class that\n    supports anything with a `_repr_X_` method (where X is `png`,\n    `gif`, etc.), a local file with the given file extension, or a\n    HTTP(S) url with the given extension.  Subclasses of each type can\n    provide their own way of obtaining or generating a PNG.\n    \"\"\"\n\n    alt_text = param.String(default=None, doc=\"\"\"\n       alt text to add to the image tag. The alt text is shown when a\n       user cannot load or display the image.\"\"\")\n\n    link_url = param.String(default=None, doc=\"\"\"\n       A link URL to make the image clickable and link to some other\n       website.\"\"\")\n\n    embed = param.Boolean(default=True, doc=\"\"\"\n        Whether to embed the image as base64.\"\"\")\n\n    imgtype = 'None'\n\n    _rerender_params = ['alt_text', 'link_url', 'embed', 'object', 'style']\n\n    _target_transforms = {'object': \"\"\"'<img src=\"' + value + '\"></img>'\"\"\"}\n\n    __abstract = True\n\n    @classmethod\n    def applies(cls, obj):\n        imgtype = cls.imgtype\n        if hasattr(obj, '_repr_{}_'.format(imgtype)):\n            return True\n        if isinstance(obj, string_types):\n            if isfile(obj) and obj.endswith('.'+imgtype):\n                return True\n            if isurl(obj, [cls.imgtype]):\n                return True\n        if hasattr(obj, 'read'):  # Check for file like object\n            return True\n        return False\n\n    def _type_error(self, object):\n        if isinstance(object, string_types):\n            raise ValueError(\"%s pane cannot parse string that is not a filename \"\n                             \"or URL.\" % type(self).__name__)\n        super(ImageBase, self)._type_error(object)\n\n    def _img(self):\n        if hasattr(self.object, '_repr_{}_'.format(self.imgtype)):\n            return getattr(self.object, '_repr_' + self.imgtype + '_')()\n        if isinstance(self.object, string_types):\n            if isfile(self.object):\n                with open(self.object, 'rb') as f:\n                    return f.read()\n        if hasattr(self.object, 'read'):\n            return self.object.read()\n        if isurl(self.object, [self.imgtype]):\n            import requests\n            r = requests.request(url=self.object, method='GET')\n            return r.content\n\n    def _imgshape(self, data):\n        \"\"\"Calculate and return image width,height\"\"\"\n        raise NotImplementedError\n\n    def _get_properties(self):\n        p = super(ImageBase, self)._get_properties()\n        if self.object is None:\n            return dict(p, text='<img></img>')\n        data = self._img()\n        if not isinstance(data, bytes):\n            data = base64.b64decode(data)\n        width, height = self._imgshape(data)\n        if self.width is not None:\n            if self.height is None:\n                height = int((self.width/width)*height)\n            else:\n                height = self.height\n            width = self.width\n        elif self.height is not None:\n            width = int((self.height/height)*width)\n            height = self.height\n        if not self.embed:\n            src = self.object\n        else:\n            b64 = base64.b64encode(data).decode(\"utf-8\")\n            src = \"data:image/\"+self.imgtype+\";base64,{b64}\".format(b64=b64)\n\n        smode = self.sizing_mode\n        if smode in ['fixed', None]:\n            w, h = '%spx' % width, '%spx' % height\n        elif smode == 'stretch_both':\n            w, h = '100%', '100%'\n        elif smode == 'stretch_width':\n            w, h = '%spx' % width, '100%'\n        elif smode == 'stretch_height':\n            w, h = '100%', '%spx' % height\n        elif smode == 'scale_height':\n            w, h = 'auto', '100%'\n        else:\n            w, h = '100%', 'auto'\n\n        html = '<img src=\"{src}\" width=\"{width}\" height=\"{height}\" alt=\"{alt}\"></img>'.format(\n            src=src, width=w, height=h, alt=self.alt_text or '')\n\n        if self.link_url:\n            html = '<a href=\"{url}\" target=\"_blank\">{html}</a>'.format(\n                url=self.link_url, html=html)\n\n        return dict(p, width=width, height=height, text=escape(html))\n\n\nclass PNG(ImageBase):\n\n    imgtype = 'png'\n\n    @classmethod\n    def _imgshape(cls, data):\n        import struct\n        w, h = struct.unpack('>LL', data[16:24])\n        return int(w), int(h)\n\n\nclass GIF(ImageBase):\n\n    imgtype = 'gif'\n\n    @classmethod\n    def _imgshape(cls, data):\n        import struct\n        w, h = struct.unpack(\"<HH\", data[6:10])\n        return int(w), int(h)\n\n\nclass JPG(ImageBase):\n\n    imgtype = 'jpg'\n\n    @classmethod\n    def _imgshape(cls, data):\n        import struct\n        b = BytesIO(data)\n        b.read(2)\n        c = b.read(1)\n        while (c and ord(c) != 0xDA):\n            while (ord(c) != 0xFF): c = b.read(1)\n            while (ord(c) == 0xFF): c = b.read(1)\n            if (ord(c) >= 0xC0 and ord(c) <= 0xC3):\n                b.read(3)\n                h, w = struct.unpack(\">HH\", b.read(4))\n                break\n            else:\n                b.read(int(struct.unpack(\">H\", b.read(2))[0])-2)\n            c = b.read(1)\n        return int(w), int(h)\n\n\nclass SVG(ImageBase):\n\n    encode = param.Boolean(default=False, doc=\"\"\"\n        Whether to enable base64 encoding of the SVG, base64 encoded\n        SVGs do not support links.\"\"\")\n\n    imgtype = 'svg'\n\n    _rerender_params = ImageBase._rerender_params + ['encode']\n\n    @classmethod\n    def applies(cls, obj):\n        return (super(SVG, cls).applies(obj) or\n                (isinstance(obj, string_types) and obj.lstrip().startswith('<svg')))\n\n    def _type_error(self, object):\n        if isinstance(object, string_types):\n            raise ValueError(\"%s pane cannot parse string that is not a filename, \"\n                             \"URL or a SVG XML contents.\" % type(self).__name__)\n        super(SVG, self)._type_error(object)\n\n    def _img(self):\n        if (isinstance(self.object, string_types) and\n            self.object.lstrip().startswith('<svg')):\n            return self.object\n        return super(SVG, self)._img()\n\n    def _imgshape(self, data):\n        return (self.width, self.height)\n\n    def _get_properties(self):\n        p = super(ImageBase, self)._get_properties()\n        if self.object is None:\n            return dict(p, text='<img></img>')\n        data = self._img()\n        width, height = self._imgshape(data)\n        if not isinstance(data, bytes):\n            data = data.encode('utf-8')\n\n        if self.encode:\n            b64 = base64.b64encode(data).decode(\"utf-8\")\n            src = \"data:image/svg+xml;base64,{b64}\".format(b64=b64)\n            html = \"<img src='{src}' width={width} height={height}></img>\".format(\n                src=src, width=width, height=height\n            )\n        else:\n            html = data.decode(\"utf-8\")\n        return dict(p, width=width, height=height, text=escape(html))\n", "path": "panel/pane/image.py"}]}