contao/core — pull request #5670 by Toflar (2013-04-18 10:07:10+00:00)
Title: Handle base64 encoded images in TCPDF

Hi everyone

@alekszmusic had an issue printing an article as PDF on one of her customer's pages.

I found that it's an issue with base64 encoded images in tinyMCE. Apparently there are cases where images are stored base64 encoded in the html source code. In this case it was Microsoft's Lync that automatically transforms phone numbers and adds an icon next to it which was then transformed to base64 by tinyMCE.

It eventually all looks perfectly fine on the website (I won't discuss the issue whether the icon belongs to the website or not).

The issue is that TCPDF can't handle base64-encoded images as it needs an URI for the image to call.

Basically we had two options:

1. Tell the customer to always edit the html code in tinyMCE and to remove the icon. Problem: they don't know html and they don't want to care about things like that.
2. We provide a workaround that turns base64 encoded images into real, temporary files which is what this pull request does.

It's a TCPDF specific problem which is why I put the code in `Controller::printArticleAsPdf()`. Please don't discuss whether it is correct or not to have base64 encoded images in tinyMCE. It's apparently something that may happen and that causes a fatal error in the front end.

What do you think?