prev='' next='' idoff=0
depth=0 ucdepth=-1
+base64() {
+ uuencode -m - <"$1" \
+ | sed '1d; :X;$!{N;bX;}; s;\n;;g; s;=\+;;g;'
+}
+
{ "${0%/*}"/cgilite/html-sh.sed || cat; } \
| {
line="$(line)"
post="${tag#*url(*)}"
file="${tag#${pre}url(}" file="${file%)$post}"
file="${file#"}" file="${file%"}"
+ echo Inlining Background Image "$file" >&2
+ if [ -r "$file" ]; then
+ tag="${pre}url('data:image/${file##*.};base64,$(base64 "$file")')${post}"
+ fi
+ done >/dev/null
+
+ ### Image embedding for Image tags
+ while expr "$tag" : '.*<img [^>]*src="[^"]\+\.\(png\|jpg\|jpeg\|gif\|svg\)"'; do
+ pre="${tag%%src=\"*\"*}"
+ post="${tag#*src=\"*\"}"
+ file="${tag#${pre}src=\"}" file="${file%\"$post}"
echo Inlining Image "$file" >&2
if [ -r "$file" ]; then
- tag="${pre}url('data:image/${file##*.};base64,$(base64 <"${file}" |tr -d \\n)')${post}"
+ tag="${pre}src=\"data:image/${file##*.};base64,$(base64 "${file}")\"${post}"
fi
done >/dev/null