Sitemap

Email2Image

A PHP library to convert an email address to an image.

1 min readOct 24, 2015

--

Email2Image is a PHP library that I wrote to securely convert email addresses to PNG images.

The project is hosted on GitHub:
https://github.com/jesseforrest/Email2Image

Get Jesse Forrest’s stories in your inbox

Join Medium for free to get updates from this writer.

This basic example will show how to select the font to be used and output an image for the email address example@example.com.

<?php 
require_once 'Email2Image.php';
$email2Image = new Email2Image();
$email2Image->setFontPath('./fonts/');
$email2Image->setFontFile('tahoma.ttf');
$email2Image->setFontSize(12);
$email2Image->setWidth(400);
$email2Image->setHeight(300);
$email2Image->setBackgroundColor('293134');
$email2Image->setForegroundColor('668aaf');
$email2Image->setHorizontalAlignment(Email2Image::MIDDLE);
$email2Image->setVerticalAlignment(Email2Image::MIDDLE);
$email2Image->setEmail('example@example.com');
$email2Image->outputImage();

The above code will output the following image:

Advanced examples using encryption and decryption are available at the above listed GitHub page.

--

--

Jesse Forrest
Jesse Forrest

Written by Jesse Forrest

Entrepreneur with a ❤ for Tech Startups. Infrastructure & Architecture @Tradesy.