PHP: Image is not being rendered into pdf even though the image URL is correct

Viewed 20

So I have an image inside a folder. Both the image and the PHP script are inside that folder.

My code (pdfgen.php):

$mpdf->setHeader('<div style="text-align: center;">
     <table>
        <tr>
          <td style="width: 500px; text-align:right;"><img src="/logo.png" width="60" height="60"></td>
          <td style="width: 1000px;"><h1 style="font-size: 35px; margin-right:5px; color: rgb(50, 91, 205);">
             <u>TITLE OF THE PDF</u></h1></td>
        </tr>
    </table>
   </div>');

The TITLE OF THE PDF gets rendered but in place of the image there's a red X. I don't know why. My file hierarchy is like this:

enter image description here

I can open the image when I go into google and type localhost/folder/logo.png. So, why isn't the image being rendered?

EDIT: I had read in some article, that it's because of the PHP gd not being installed into the system. So I went into my php.ini file and uncommented this:

extension=gd

But the image is still not being rendered

1 Answers

As told by @M.Eriksson, src="logo.png" worked

Related