email inline images in base 64 through email with php code igniter

I am generating images dynamically at run time with php and have them displayed in base 64 through the browser. This same page/html document I need emailed but this method to show images does not work through email.

I have found two code igniter libraries to try and help me with this task two of which do not work

The first one gives me

   Unable to send email using PHP mail(). Your server might not be configured to send mail using this method.

    From: "SystemDDX" Return-Path: Reply-To: "" X-Sender: X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: <> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit

The second one is extremely outdated

The only method which I've managed to get working so far is using the code igniter $this->email->attach("C:\myfile.jpg") and then in my html reference using
<img src='cid:myfile.jpg' />
The problem is my image is in base64 as I'm generating it dynamically so if I can't figure out anything else, how can I revert base 64 to a specific file name while keeping it in memory.

Please any tips and help would be greatly appreciated
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Use imagecreatefromstring() in combination with base64_decode() to generate an image file from your image object:

       . 'EX4IJTRkb7lobNUStXsB0jIXIAMSsQnWlsV+wULF4Avk9fLq2r'
       . '8a5HSE35Q3eO2XP1A1wQkZSgETvDtKdQAAAABJRU5ErkJggg==';
$data = base64_decode($data);

$im = imagecreatefromstring($data);
if ($im !== false) {
    imagepng($im, 'tmp/myimage.png');

Open in new window

(taken from the PHP documentation:

Could this work for you? Keep us posted!

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.