Change emoji resolution if not converting format

This commit is contained in:
Bob Mottram 2017-11-11 11:47:07 +00:00
parent 0d1368fddc
commit a943e8e976
1 changed files with 5 additions and 1 deletions

View File

@ -387,6 +387,8 @@ function pleroma_disable_registrations {
} }
function pleroma_add_emoji { function pleroma_add_emoji {
emoji_resolution='64x64'
data=$(tempfile 2>/dev/null) data=$(tempfile 2>/dev/null)
trap "rm -f $data" 0 1 2 5 15 trap "rm -f $data" 0 1 2 5 15
dialog --backtitle $"Freedombone Control Panel" \ dialog --backtitle $"Freedombone Control Panel" \
@ -444,7 +446,7 @@ function pleroma_add_emoji {
fi fi
if [[ "$image_url" == *'.jpg' || "$image_url" == *'.jpeg' || "$image_url" == *'.gif' ]]; then if [[ "$image_url" == *'.jpg' || "$image_url" == *'.jpeg' || "$image_url" == *'.gif' ]]; then
convert $image_filename -resize 64x64 $PLEROMA_DIR/custom_emoji/${shortcode}.png convert $image_filename -resize $emoji_resolution $PLEROMA_DIR/custom_emoji/${shortcode}.png
if [ ! -f $PLEROMA_DIR/custom_emoji/${shortcode}.png ]; then if [ ! -f $PLEROMA_DIR/custom_emoji/${shortcode}.png ]; then
dialog --title $"Add Custom Emoji" \ dialog --title $"Add Custom Emoji" \
--msgbox $"Unable to convert empji image to png format" 6 60 --msgbox $"Unable to convert empji image to png format" 6 60
@ -456,6 +458,8 @@ function pleroma_add_emoji {
image_extension='png' image_extension='png'
image_filename=$PLEROMA_DIR/custom_emoji/${shortcode}.${image_extension} image_filename=$PLEROMA_DIR/custom_emoji/${shortcode}.${image_extension}
else
convert $image_filename -resize $emoji_resolution $image_filename
fi fi
if ! grep -q "${shortcode}," $image_filename; then if ! grep -q "${shortcode}," $image_filename; then