I want to Host WordPress thumbnails as base64

how to base64 encode images in wordpress template

I followed the tutorial from this and pasted the code in functions.php file

Now i am getting problem in temtplate level

I want to imageEncode() the following code

How can I achieve this