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

Ben Parzybok info at ideacog.net
Wed May 25 20:44:13 UTC 2005


Hi Haris,
Thanks for your reply.

> 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?

My file extensions are correct, i've tried .png, .jpg and .gif with  
the same results.
However I did have the language set to PHP. Trying HTML (PHP)  
resulted in the same binary output.

Interestingly the drag command does work for href links.

OK, I just duplicated my drag <a> command and re-entered the code for  
the img drag command

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) }'

and reset the file extensions and it worked.
The one thing that was different was the scope field, which I guess I  
don't understand yet.
It used to be: text.html.markdown
and now it's just:
text.html

Also I should note that the drag command that's working is now under  
the HTML heading (because I duplicated the drag <a> command that was  
there) and not under the Markdown heading in the bundle editor.

-Ben



More information about the textmate mailing list