Tag Archives for pdf

Auth fail on image stream when generating PDF’s with PHP

The error:
PHP Warning: failed to open stream: HTTP request failed! HTTP/1.1 401 Unauthorized

…and you either get blanks where there should be images in your PDF, or you get no PDF at all. I encountered this problem while using wp-post-to-pdf-enhanced and Kalin’s PDF Creation Station for WordPress.

The methods throwing the warning:
getimagesize()
imagecreatefromjpeg()

The cause:
This appears to happen under 2 conditions: Apache authentication is required on the directory, AND the path to the image file contains directories named with numbers.

The fix:
You need to change just one of these conditions for it to work. Either rename the image directories to NOT begin with numbers, OR remove the apache authentication.

24. February 2017 by admin
Tags: , , , | Leave a comment