html2pdf
html2pdf copied to clipboard
Unable to get the size of the image with cache busting or with a slash at the begining of a relative path
There are two case that should work but doesn't:
the first one is when you have cache busting enable for a file, the path look like this:
_assets/26a1fad161d9cc7355c7ed2e7fb3021d/Images/my_image.png?1753878085
the second one is when you have a slash at the beginning of the relative file path:
/_assets/26a1fad161d9cc7355c7ed2e7fb3021d/Images/my_image.png
This will generate an exception:
(1/1) #2 Spipu\Html2Pdf\Exception\ImageException
Unable to get the size of the image [./_assets/26a1fad161d9cc7355c7ed2e7fb3021d/Images/mapa-chemical_black.png?1753878085]
This exception is generated by the function @getimagesize($src) in method Html2pdf::_drawImage()
if your path begins with "/" it means that it is a absolute path, not a relative. else, it is a relative path. For a relative path, it must be relative from your main php script.