Marcello Impastato
Marcello Impastato

Reputation: 2281

How insert image in a email without call url and without use attachment?

Looking for html-email format, how i can include a jpeg-image (logo) in a email without call absolute address from website and without put it as attachment in it? Thanks.

Upvotes: 1

Views: 676

Answers (1)

Kyborek
Kyborek

Reputation: 1511

Basically you need to read the contents of the image and transfer them to data uri which you can "inline" into the html like this:

$image_data=file_get_contents("some_image.jpg");
$encoded=base64_encode($image_data);
echo "<img src='data:image/jpeg;base64,{$encoded}'>";

Of course you will not echo the image tag, you just ineed to put it into the email with your preferred mailer client.

Upvotes: 1

Related Questions