[TxMt] <img> & <css> drag commands

Allan Odgaard allan at macromates.com
Wed Mar 30 14:41:44 UTC 2005


On Mar 30, 2005, at 16:30, Michael wrote:

>> Does it use the command then both for your image and CSS? or did you 
>> make the change for both drag commands?
> I only modified the image drag command, and when I tried to drag a css 
> file it still inserted the source of the file, but after trying the 
> drag command listed below for css it works fine - thanks.
>
> Any suggestions for the image drag command?

Well, try to restore it to:

img="$TM_DROPPED_FILE"
alt=`echo $img | perl -pe 's/^(.*\/)?(.*?)(\..*)?$/$2/g' | tr '_-' ' '`
sips -g pixelWidth -g pixelHeight "$img" | awk '/pixelWidth/ { w=$2 } 
/pixelHeight/ { h=$2 } END { printf("<img src=\"'"$img"'\" width=\"%d\" 
height=\"%d\" alt=\"${0:'"$alt"'}\" />", w, h) }'

If this fails, try one thing at a time, e.g. just:
sips -g pixelWidth -g pixelHeight "$TM_DROPPED_FILE"

Btw: if you have an IRC client, msg me on #textmate / FreeNode, that's 
a bit easier than this...




More information about the textmate mailing list