I’m new to web development and I’m recently asked to help building a website. I encountered an image issue that need ppl’s help.
In the existing html code, they specify the image path as:
<img src="/site-media/Logo.jpg" alt="Logo" style="margin:auto;display:block;height:70px;width:230px;"></img> and it worked fine. However, when I try to use a software called wkhtmltopdf, which is a tool to convert html to pdf, I had problems. It seems that this tool only recognize absolute/relative path for images, but doesn’t recognize patterns that django specifies in url.py like
r’^site-media/(?P.*)$’
. As a result, my pdf files are generated without images. How do I get around with this issue?
have you tried adding
<base href="http://yourdomain.com" />to your html head? not sure if wkhtmltopdf would catch that, but it’s worth a shot… you can also try adding the domain to your image tags, since^site-mediais just a “folder” under your domain (according to the url rewriter)