filsa.net: Frontier / Scripts / Weird Macros / Img Tag Converter
This is part of Phil's Script Archive

UPDATED: Ready for Frontier 5!

Img Tag Converter

Converts <img> tags into imgRef macros.


This fat web page contains the img2imgRef script object.

Use the 'Get Page Data' command from the Scripts menu to copy img2imgRef into your object database.

Also available: info about fat pages and the Terms under which you can use this script.

This isn't a macro. It's sample code.

Why I wrote it.

Sometimes I import a html file into Frontier, to use in a website.

Retyping <img> tags into macro form {imageRef ()} drove me nuts.

So I wrote this.

How I use it.

I highlight an img tag in the wptext object that has the html.

Then I select the 'img tag fixer' item in my custom menu. This menu command hooks into the img2imgRef script. (which I keep in my personal suite, suites.PS).

A second later, I get this:

Note that I don't use the standard imageRef macro. I've been using Jeb Bateman's enhanced imageRef macro (EIR) for a long time, and found it quite handy. The way Jeb's EIR works with attributes made it much easier to write this script. Making this script work with Userland's imageRef is not much more difficult, but there's more coding to be done and I'm too lazy to work on it.

Note that I renamed Jeb's EIR (which usually is at user.html.macros.imageRef) to imgRef, just to keep things distinct in my mind. I've got pages that use both, and I wanted to keep them separate.

Questions

Q: Phil, will you be updating this script at all, to work with Userland's imageRef?

A: Nope!

Q: Can I use this code, and modify it to suit the way I work?

A: Yep!

Q: How do you find the time to make pages like this?

A: Generally, when I'm procrastinating, I find time to do silly stuff like this.

Notes

This will install at workspace.img2imgRef.

Move it someplace, whereever you like, and then rig up a menu command for it in your custom menu.

Tweak the code as necessary.

Oh yeah, you need to import the graphic separately into your website for the imgRef macro to work (duh!).

Note that as of Frontier 5.1 I've stopped using Jeb's Enhanced ImageRef because the Userland-supplied imageRef finally has most of the features I need. Thanks to Jeb for a great script, though-- you can find more of his Frontier stuff at http://www.ocha.net.

Enjoy!

View the Source: workspace.img2imgRef


© copyright 1997-98 by Philip Suh. Comments are appreciated.
This page last updated on 11/8/98; 1:23:21 PM.
<http://www.filsa.net/frontier/scripts/WeirdMacros/img2imgRef.html>
filsa.net: Frontier / Scripts / Weird Macros / Img Tag Converter