// this php module should be called with an argment of the image filename
// and outputs a base64 encoded image file as a .txt file.
// Please edit the directory locations to suit your setup.
// Of course you need to have PHP installed on your computer to use this module.

<?php

$file = $argv[1];
$newfilename = $file . '.txt';
$file = 'E:/temp/Images/' . $file;
$newfilename = 'E:/temp/Base64Files/' . $newfilename;

if($fp = fopen($file,"rb", 0))
{
   $picture = fread($fp,filesize($file));
   fclose($fp);
   // base64 encode the binary data, then break it
   // into chunks according to RFC 2045 semantics
   $base64 = chunk_split(base64_encode($picture));
   $newfile = fopen($newfilename, 'a');
   fwrite($newfile,$base64 );
   fclose($newfile);

}

?>