I'm trying to use an external graphic with xslt for PDF generation. Most images are working fine but every now and again one is 'not found' despite being viewable on a web browser. Here's the error that FOP spits out:
11:29:15.653 [main] ERROR org.apache.fop.apps.FOUserAgent - Image not found. URI: http://memesvault.com/wp-content/uploads/Derp-Meme-031.jpg. (No context info available)
And here's my external-graphic section:
<xsl:variable name="mediaUrl">
<xsl:value-of select="mediaUrl" />
</xsl:variable>
<fo:external-graphic src="url('{$mediaUrl}')"
height="200"
max-width="200"
content-width="scale-to-fit" />
Any idea what I'm doing wrong?
Edit: it looks like this problem is related to a server not permitting access for the automated request. Is there a way to set the User Agent's URIResolver in fop 2.1? It appears that this functionality existed in prior versions but I can't seem to find a way to do it with 2.1.
Error with opening URL 'http://memesvault.com/wp-content/uploads/Derp-Meme-031.jpg': Server returned HTTP response code: 403 for URL: http://memesvault.com/wp-content/uploads/Derp-Meme-031.jpg
. Maybe the site is configured to refuse requests having / not having specific user agents, to avoid site scraping? – lfurini