Thanks for the information here. I am finding this embedding useful and particularly for mobile especially with the embedded images' css file being cached.
To help make life easier, as my file editor(s) do not natively handle this, I made a couple of simple scripts for laptop/desktop editing work, share here in case they are any use to any one else. I have stuck with php as it is handling these things directly and very well.
Under Windows 8.1 say---
C:\Users\`your user name`\AppData\Roaming\Microsoft\Windows\SendTo
... there as an Administrator you can establish a shortcut to a batch file in your path. That batch file will call a php (cli) script.
You can then right click an image in file explorer, and SendTo the batchfile.
Ok Admiinstartor request, and wait for the black command shell windows to close.
Then just simply paste the result from clipboard in your into your text editor...
<img src="|">
or
`background-image : url("|")`
Following should be adaptable for other OS.
Batch file...
rem @echo 0ff
rem Puts 64 encoded version of a file on clipboard
php c:\utils\php\make64Encode.php %1
And with php.exe in your path, that calls a php (cli) script...
<?php
function putClipboard($text){
// Windows 8.1 workaround ...
file_put_contents("output.txt", $text);
exec(" clip < output.txt");
}
// somewhat based on http://perishablepress.com/php-encode-decode-data-urls/
// convert image to dataURL
$img_source = $argv[1]; // image path/name
$img_binary = fread(fopen($img_source, "r"), filesize($img_source));
$img_string = base64_encode($img_binary);
$finfo = finfo_open(FILEINFO_MIME_TYPE);
$dataType = finfo_file($finfo, $img_source);
$build = "data:" . $dataType . ";base64," . $img_string;
putClipboard(trim($build));
?>