[TextMate] Feature Request

Justin French justin.french at indent.com.au
Tue Oct 12 01:50:57 UTC 2004


On 12/10/2004, at 10:18 AM, Eric Curtis wrote:

> I have been letting this subject percolate for a few days in my head 
> and I just can not think of another workaround that would approach any 
> reasonable level of efficiency (I would love to hear some though). I 
> could make a macro and have it tab stop at the name, width, height and 
> alt however I am not going to know the width and height in 99% of the 
> cases. I personally would also like to have it automatically add the 
> file name without the extension as the alt tag though some might argue 
> that this will promote poor coding practices, I tend to label my files 
> with readable names...
>
> Please take care of this ASAP...

I don't think this can be taken care of with Macros or existing 
commands, so it might have to be "hard coded" into TM, which will take 
longer... it's on my personal to-do/mission list 
<http://wiki.macromates.com/textmate/show/JustinFrenchToDo>, and I'm 
emailing Allan some ideas right now...

In the meantime, may I suggest the following:

- use the img snippet (type img[tab]) which excludes height and width
- modify the img snippet so that it has a place holder where height & 
width should be
- use Finder and the "Dimensionizer" contextual menu plug-in [1] to get 
the height and width string for you, paste into TM

It isn't pretty, but it's a temporary workflow that works for me.

Then again, most of the time I use PHP to grab my images on the fly... 
instead of:
	<img src="eric.jpg" alt="eric" width="100" height="100" />
I'd have:
	<?=imageTag('eric.jpg','Photo of Eric')?>

imageTag() checks for a valid image and location (no more broken image 
links), determines the height and width, and if the 2nd attribute isn't 
given (alt text), it will "make up" an alt tag based on the filename 
(eg "Eric"), then generates the tag.

I can't remember the last time I wrote an image tag actually!  I think 
I'll write up this imageTag() function of mine on my blog [2] in the 
next few days, so any one who's interested, keep an eye out.

[1] http://automaticlabs.com/products/dimensionizer/
[2] http://justinfrench.com


Justin French







More information about the textmate mailing list