05-08-2024
This commit is contained in:
45
img.sh
Executable file
45
img.sh
Executable file
@@ -0,0 +1,45 @@
|
||||
#!/usr/bin/env bash
|
||||
if [ $# -lt 1 ]; then
|
||||
echo "Usage: $(basename $0) file ..."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
function load_version() {
|
||||
if [ -z ${IT2DL_BASE64_VERSION+x} ]; then
|
||||
export IT2DL_BASE64_VERSION=$(base64 --version 2>&1)
|
||||
fi
|
||||
}
|
||||
|
||||
function b64_encode() {
|
||||
load_version
|
||||
if [[ "$IT2DL_BASE64_VERSION" =~ GNU ]]; then
|
||||
# Disable line wrap
|
||||
base64 -w0
|
||||
else
|
||||
base64
|
||||
fi
|
||||
}
|
||||
|
||||
#printf "\n\033]1337;File=;inline=1:`cat soco-cli-logo-01-large.png | base64`\a\n"
|
||||
#printf "\n\033]1337;File=;width=200px;inline=1:`cat soco-cli-logo-01-large.png | base64`\a\n"
|
||||
|
||||
|
||||
for fn in "$@"
|
||||
do
|
||||
if [ -r "$fn" ] ; then
|
||||
[ -d "$fn" ] && { echo "$fn is a directory"; continue; }
|
||||
#printf '\033]1337;File=name=%s;width=200px;inline=1' $(echo -n "$fn" | b64_encode)
|
||||
|
||||
printf "\n\033]1337;File=;width=200px;inline=1:`cat soco-cli-logo-01-large.png | base64`\a\n"
|
||||
|
||||
echo $?
|
||||
|
||||
|
||||
#wc -c "$fn" | awk '{printf "size=%d",$1}'
|
||||
#printf ":"
|
||||
#base64 < "$fn"
|
||||
#printf '\a'
|
||||
else
|
||||
echo File $fn does not exist or is not readable.
|
||||
fi
|
||||
done
|
||||
Reference in New Issue
Block a user