Skip to content

Instantly share code, notes, and snippets.

@lucifr
Created September 20, 2012 05:49
Show Gist options
  • Select an option

  • Save lucifr/3754170 to your computer and use it in GitHub Desktop.

Select an option

Save lucifr/3754170 to your computer and use it in GitHub Desktop.

Revisions

  1. lucifr revised this gist Sep 20, 2012. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion image_process.bash
    Original file line number Diff line number Diff line change
    @@ -1,7 +1,7 @@
    #!/bin/bash
    #
    # requirements:
    # - ImageMagick: http://www.imagemagick.org/script/binary-releases.php#macosx
    # - ImageMagick: http://www.imagemagick.org/script/binary-releases.php#macosx
    # - image_optim: https://github.com/toy/image_optim
    # - a scp supported host with ssh key paired

  2. lucifr revised this gist Sep 20, 2012. 1 changed file with 3 additions and 3 deletions.
    6 changes: 3 additions & 3 deletions image_process.bash
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,9 @@
    #!/bin/bash
    #
    # requirements:
    # - ImageMagick: http://www.imagemagick.org/script/binary-releases.php#macosx
    # - image_optim: https://github.com/toy/image_optim
    # - a scp supported host with ssh key paired
    # - ImageMagick: http://www.imagemagick.org/script/binary-releases.php#macosx
    # - image_optim: https://github.com/toy/image_optim
    # - a scp supported host with ssh key paired

    # setting up the enviroment
    export PATH=/usr/local/bin:/opt/local/bin:/opt/local/sbin:$PATH
  3. lucifr revised this gist Sep 20, 2012. 1 changed file with 0 additions and 46 deletions.
    46 changes: 0 additions & 46 deletions image_process
    Original file line number Diff line number Diff line change
    @@ -1,46 +0,0 @@
    #!/bin/bash
    #
    # requirements:
    # - ImageMagick: http://www.imagemagick.org/script/binary-releases.php#macosx
    # - image_optim: https://github.com/toy/image_optim
    # - a scp supported host with ssh key paired

    # setting up the enviroment
    export PATH=/usr/local/bin:/opt/local/bin:/opt/local/sbin:$PATH

    # please change the following variable to your own:
    # folder: local dir for the image, default ~/Desktop/
    # server: your scp server, e.g. 123.456.789.0
    # username: your username for the server, e.g. root
    # dir: remote dir for the image, e.g. /public/www/uploads/
    # url: url for the image, e.g. http://yourwebsite.com/uploads/

    folder=/Users/$(whoami)/Desktop/
    server=123.456.789.0
    username=root
    dir=/public/www/uploads/
    url=http://yourwebsite.com/uploads/
    filename=`echo "{query}" | tr 'A-Z' 'a-z' | tr -s ' ' | tr ' ' '_'`_`date +%s`.png
    path=$folder$filename
    screencapture -i $path
    while [ ! -f $path ]
    do
    sleep 1
    done
    width=`/usr/bin/osascript << EOT
    tell application "System Events"
    activate
    set theWidth to (display dialog "Enter the width" default answer "650")
    end tell
    set theWidth to the text returned of theWidth as integer
    return theWidth
    EOT`
    while [ -z "$width" ]
    do
    sleep 1
    done
    convert $path -resize "`echo $width`x>" $path
    image_optim --no-pngout $path
    echo \![{query}]\($url$filename\) | pbcopy
    scp $path $username@$server:$dir
    echo $filename uploaded!
  4. lucifr revised this gist Sep 20, 2012. 1 changed file with 46 additions and 0 deletions.
    46 changes: 46 additions & 0 deletions image_process
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    #!/bin/bash
    #
    # requirements:
    # - ImageMagick: http://www.imagemagick.org/script/binary-releases.php#macosx
    # - image_optim: https://github.com/toy/image_optim
    # - a scp supported host with ssh key paired

    # setting up the enviroment
    export PATH=/usr/local/bin:/opt/local/bin:/opt/local/sbin:$PATH

    # please change the following variable to your own:
    # folder: local dir for the image, default ~/Desktop/
    # server: your scp server, e.g. 123.456.789.0
    # username: your username for the server, e.g. root
    # dir: remote dir for the image, e.g. /public/www/uploads/
    # url: url for the image, e.g. http://yourwebsite.com/uploads/

    folder=/Users/$(whoami)/Desktop/
    server=123.456.789.0
    username=root
    dir=/public/www/uploads/
    url=http://yourwebsite.com/uploads/
    filename=`echo "{query}" | tr 'A-Z' 'a-z' | tr -s ' ' | tr ' ' '_'`_`date +%s`.png
    path=$folder$filename
    screencapture -i $path
    while [ ! -f $path ]
    do
    sleep 1
    done
    width=`/usr/bin/osascript << EOT
    tell application "System Events"
    activate
    set theWidth to (display dialog "Enter the width" default answer "650")
    end tell
    set theWidth to the text returned of theWidth as integer
    return theWidth
    EOT`
    while [ -z "$width" ]
    do
    sleep 1
    done
    convert $path -resize "`echo $width`x>" $path
    image_optim --no-pngout $path
    echo \![{query}]\($url$filename\) | pbcopy
    scp $path $username@$server:$dir
    echo $filename uploaded!
  5. lucifr renamed this gist Sep 20, 2012. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  6. lucifr created this gist Sep 20, 2012.
    46 changes: 46 additions & 0 deletions image_process
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,46 @@
    #!/bin/bash
    #
    # requirements:
    # - ImageMagick: http://www.imagemagick.org/script/binary-releases.php#macosx
    # - image_optim: https://github.com/toy/image_optim
    # - a scp supported host with ssh key paired

    # setting up the enviroment
    export PATH=/usr/local/bin:/opt/local/bin:/opt/local/sbin:$PATH

    # please change the following variable to your own:
    # folder: local dir for the image, default ~/Desktop/
    # server: your scp server, e.g. 123.456.789.0
    # username: your username for the server, e.g. root
    # dir: remote dir for the image, e.g. /public/www/uploads/
    # url: url for the image, e.g. http://yourwebsite.com/uploads/

    folder=/Users/$(whoami)/Desktop/
    server=123.456.789.0
    username=root
    dir=/public/www/uploads/
    url=http://yourwebsite.com/uploads/
    filename=`echo "{query}" | tr 'A-Z' 'a-z' | tr -s ' ' | tr ' ' '_'`_`date +%s`.png
    path=$folder$filename
    screencapture -i $path
    while [ ! -f $path ]
    do
    sleep 1
    done
    width=`/usr/bin/osascript << EOT
    tell application "System Events"
    activate
    set theWidth to (display dialog "Enter the width" default answer "650")
    end tell
    set theWidth to the text returned of theWidth as integer
    return theWidth
    EOT`
    while [ -z "$width" ]
    do
    sleep 1
    done
    convert $path -resize "`echo $width`x>" $path
    image_optim --no-pngout $path
    echo \![{query}]\($url$filename\) | pbcopy
    scp $path $username@$server:$dir
    echo $filename uploaded!