A while ago, I was try to make a command to add height and width information to turn a selected word " LBC0001A-1.tif " into code like:
<img src="LBC0001A-1.tif" height="800"/>
"sips", a built in command line tool seems to provide the required facilities, if anyone is interested in making such a command.
sips -g all /Users/tim/Sites/favicon.png pixelWidth: 16 pixelHeight: 16 typeIdentifier: public.png format: png formatOptions: default dpiWidth: 95.987 dpiHeight: 95.987 samplesPerPixel: 4 bitsPerSample: 8 hasAlpha: yes space: RGB
Can also resample and rotate images, etc.
tim
This is just a modified version of the Drop Command "Insert Image With Dimensions" that alread exists
img="$TM_SELECTED_TEXT" echo -n "<img src="$img" "
sips -g pixelWidth -g pixelHeight "$img" \ |awk '/pixelWidth/ { printf("width="%d" ", $2) } /pixelHeight/ { printf("height="%d" ", $2) }'
base=${img##*/} alt=$(tr <<<${base%.*} '[_-]' ' '|perl -pe 's/(\w+)/\u$1/g') echo -n "alt="${1:$alt}" />"
--
Input: Selected Text Output: Insert as Snippet
ciao Martin
On 5/12/06, Timothy Bates timothy.c.bates@gmail.com wrote:
A while ago, I was try to make a command to add height and width information to turn a selected word " LBC0001A-1.tif " into code like:
<img src="LBC0001A-1.tif" height="800"/>
"sips", a built in command line tool seems to provide the required facilities, if anyone is interested in making such a command.
sips -g all /Users/tim/Sites/favicon.png pixelWidth: 16 pixelHeight: 16 typeIdentifier: public.png format: png formatOptions: default dpiWidth: 95.987 dpiHeight: 95.987 samplesPerPixel: 4 bitsPerSample: 8 hasAlpha: yes space: RGB
Can also resample and rotate images, etc.
tim
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
Thank you martin, I'd didn't look inside the drag and drop command, partly 'cause when I did look at it a few months ago I stopped when I saw the awk, perl, piping, and stuff I couldn't even guess at like (<<<) and switched to Adobe DreamWeaver and AppleScript to get the job done.
As the command I'm thinking off would need to be able to translate relative paths from the edited file to the image, then pass these to sips, it is beyond the time I can give to it.
I think it is a pity the base html module doesn't expand more html commands, has no ECMA script help. Both these keep me having DW open, and using edit in TM from Dreamweaver if I want to do some nice TM things to the code.
A massive missing feature for html editing is the ability to figure out and offer all the options to all the tags: DW does this seamlessly, and also allows smart re-editing (i.e., it matches tag changes, and detects your context to offer sensible things like a list of valid img parameters when it sees you are inside an img tag.
I'd like to see this stuff in TM, but am up to adding it.
I have written a few dozen snippets to add more html items, and too help with jScript coding, but there's miles to go.
Thanks for your time T "markets are a voting machine in the short run (voters can elect any goofy outcome they want)... but they are a weighing machine in the long run (when the voters get what they have coming.)