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

Charilaos Skiadas skiadas at math.uchicago.edu
Wed May 25 20:19:10 UTC 2005


On May 25, 2005, at 2:53 PM, Ben Parzybok wrote:

> 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 just tried it, and it works fine for me. Are you sure the image you 
are dragging has one of the extensions that are handled by the drag? I 
renamed the extension of a jpg image to jpe, and it got loaded as 
binary data instead, but when its extension was jpg, it worked as 
expected. Also, if the spelling was Jpg, then it was not  recognized 
either.
Also, are you certain the language for the file is html?

>
> I have:
> img=$TM_DROPPED_FILE
> alt=`echo $img | perl -pe 's/^(.*\/)?(.*?)(\..*)?$/$2/g' | tr '_-' ' '`
> echo -n "![\${1:$alt}]($TM_DROPPED_FILE)"

This is what I have:
img="$TM_DROPPED_FILE"
alt=`perl <<<$img -pe 's/^(.*\/)?(.*?)(\..*)?$/$2/g; y/_-/ /'`
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) }'

> 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

So, unless your file has as extension EXACTLY one of those, it will not 
work.
> --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.

This should not affect things, the latex drag command should work only 
if the language is latex.
> Does anyone have any suggestions?
>
> Thanks in advance,
> Ben

Haris




More information about the textmate mailing list