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 http://thecodeabode.blogspot.com/2010/11/codeigniter-and-php-howto-embedding.html

http://codeigniter.com/wiki/Richmail/

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: "internal-33e@google.com" X-Sender: internal-33ek@google.com X-Mailer: CodeIgniter X-Priority: 3 (Normal) Message-ID: <1d42c5c99deeb@google.com> 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
NewtonianBAsked:
Who is Participating?
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.

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

$data = 'iVBORw0KGgoAAAANSUhEUgAAABwAAAASCAMAAAB/2U7WAAAABl'
       . 'BMVEUAAAD///+l2Z/dAAAASUlEQVR4XqWQUQoAIAxC2/0vXZDr'
       . '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: http://de2.php.net/manual/de/function.imagecreatefromstring.php)

Could this work for you? Keep us posted!
0

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
PHP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.