Logo Hardware.com.br
AcNeto
AcNeto Veterano Registrado
758 Mensagens 56 Curtidas

Adiconar "redimensionar imagem" a script.

#1 Por AcNeto 29/09/2013 - 16:15
Boa Tarde.

Atualmente estou usando o Linux Mint 13, e vi que não existe a opção "enviar para" ou está desabilitada e não achei onde habilitar.
Então encontrei um script onde adiciona direto a opção "enviar para thunderbird" e nele abre uma janela perguntando se quer compactar, achei bem legal isso.
Mas o que sinto falta e que o thunderbird do windows faz é redimensionar a foto, quando selecionado com botão direito em cima de uma ou várias fotos, ele dá a opção de redimensionar, assim fazendo uma foto de 3mb por ex: cair para 500kb.
Gostaria de acrescentar isso a esse script, que além de pedir na primeira janela para compactar, que abra uma segunda janela perguntando se quer redimensionar.

O script é esse:


#!/bin/bash
#
# NAME: Send files using Thunderbird
# AUTHOR: Ronan Arraes Jardim Chagas <ronisbr@gmail.com>
# DATE: 19 Apr 2012
#
# Copyright (C) 2012 Ronan Arraes Jardim Chagas <ronisbr@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

###
# Variables
##

DIALOG="matedialog"
EMAIL_CLIENT="thunderbird"
ZIP="zip"
RAR="rar a"
TARGZ="tar -czf"
TARBZ2="tar -cjf"

###
# Script
###

# If no file was selected, then just exit
[ "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" == "" ] && exit 1;

# Ask how the user wants to send the file
answer=$($DIALOG --title "Send file using Thunderbird " --text "Do you want to compress the files?" --list --radiolist --column "Choice" --column "Format" true "Do not compress" false ".zip" false ".rar" false ".tar.gz" false ".tar.bz2&quot
[ $? -ne 0 ] && exit 1

if [ "$answer" == "Do not compress" ];
then
# The user does not want to compress the files
command_option="-compose attachment='$(echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | awk 'BEGIN { FS = "\n" } { printf "%s,", $1 }' | sed -e s#,,## )'"
$EMAIL_CLIENT $command_option
else
# Ask how the user wants to name the compressed file
filename_out=$($DIALOG --entry --text "Enter the compressed file name (extension will be added):" --entry-text "attachment&quot
[ $? -ne 0 ] && exit 1

filename_in=$(echo "$NAUTILUS_SCRIPT_SELECTED_FILE_PATHS" | awk 'BEGIN { FS = "\n" } { printf "%s ", $1 }')

case $answer in
# The user wants .zip
".zip&quot
if [ -e /tmp/$filename_out.zip ];
then
rm /tmp/$filename_out.zip
fi

# Compress the file
$ZIP /tmp/$filename_out.zip "$@"
command_option="-compose attachment='/tmp/$filename_out.zip'"
;;

# The user wants .rar
".rar&quot
if [ -e /tmp/$filename_out.rar ];
then
rm /tmp/$filename_out.rar
fi

# Compress the file
$RAR /tmp/$filename_out.rar "$@"
command_option="-compose attachment='/tmp/$filename_out.rar'"
;;

# The user wants .tar.gz
".tar.gz&quot
if [ -e /tmp/$filename_out.tar.gz ];
then
rm /tmp/$filename_out.tar.gz
fi

# Compress the file
$TARGZ /tmp/$filename_out.tar.gz "$@"
command_option="-compose attachment='/tmp/$filename_out.tar.gz'"
;;

# The user wants .tar.bz2
".tar.bz2&quot
if [ -e /tmp/$filename_out.tar.bz2 ];
then
rm /tmp/$filename_out.tar.bz2
fi

# Compress the file
$TARBZ2 /tmp/$filename_out.tar.bz2 "$@"
command_option="-compose attachment='/tmp/$filename_out.tar.bz2'"
;;
esac

$EMAIL_CLIENT $command_option
fi


Abraço.
Placa Gigabyte 970-ud3p / Cooler Master TX3 Evo / Placa de vídeo GTX 750Ti
Processador FX 8320 / 16 GB Corsair Vengeance 1600
SSD OCZ 128 Sistemas (Win7 64/Mint 64)
HD 2 TB, 2 TB WD / HD 3 TB Seagate
Fonte corsair 520W /Dual Monitor LG 23"
© 1999-2024 Hardware.com.br. Todos os direitos reservados.
Imagem do Modal