Hi, I'm reviving this somewhat old thread on dragging images (and css) into an open html file. I'm unable to get an <img> tag when I try to drag an image into an open html file, I get only the very long binary write-out.
I've tried playing with the snippet as per this thread (dated March '05). I'm using 1.09b with a refreshed svn checkout (as of 5/25/05).
Just for the fun of it, I just removed all my local bundles ~/Library/ Application Support/Textmate in case some setting I'd created was overwriting the new bundles (I may be confused on how this works, but I think it's like this)
I have: img=$TM_DROPPED_FILE alt=`echo $img | perl -pe 's/^(.*/)?(.*?)(..*)?$/$2/g' | tr '_-' ' '` echo -n "![${1:$alt}]($TM_DROPPED_FILE)"
as the Drag command in the bundle editor. (under Markdown/Insert <img> tag) Applying to these file types: png, PNG, jpeg, JPEG, jpg, JPG, gif, GIF
This hasn't worked for me on the last couple of betas, and I've neglected to take the time to figure out if it was something I did or was the result of the new beta development. Since I haven't heard anyone mention it, I'm guessing I frigged w/ something at one time.
I just tried: sips -g pixelWidth -g pixelHeight "$TM_DROPPED_FILE" in place of the drag command above, but I still get binary output instead of an <img> tag w/ the path. Is it possible I have one drag command taking precedence over the one I'm looking at?
--OK, I just listed only drag commands and found there was also a Latex img drag command. I've tried removing the latex bundle, restarting, trying the drag command. Then replacing latex, removing markdown bundle and trying drag command. Still no go.
Does anyone have any suggestions?
Thanks in advance, Ben
On Mar 30, 2005, at 6:41 AM, Allan Odgaard wrote:
On Mar 30, 2005, at 16:30, Michael wrote:
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...
For new threads USE THIS: textmate@lists.macromates.com (threading gets destroyed and the universe will collapse if you don't) http://lists.macromates.com/mailman/listinfo/textmate