Check / fix support for remote images

This commit is contained in:
Jake Howard 2017-05-11 13:19:14 +01:00
parent af8464e344
commit 847b783ea3
2 changed files with 6 additions and 1 deletions

View file

@ -22,7 +22,9 @@ def add_base_tag(doc, config):
logger.debug("Adding Base Tag...") logger.debug("Adding Base Tag...")
soup = BeautifulSoup(doc, 'html.parser') soup = BeautifulSoup(doc, 'html.parser')
for img in soup.findAll('img'): for img in soup.findAll('img'):
img['src'] = os.path.abspath(img['src']) abs_path = os.path.abspath(img['src'])
if os.path.isfile(abs_path):
img['src'] = abs_path
return soup.prettify() return soup.prettify()

View file

@ -2,3 +2,6 @@
![title](./test-image.png) ![title](./test-image.png)
![Example remote image](http://image.spreadshirtmedia.com/image-server/v1/designs/11735885,width=178,height=178/TV-Test-Screen.png)