Image Wrap Clip

This clip will wrap images into xhtml pages for viewing. It works like this:
1. all files must be closed before the clip is run
2. you will want to have your image in their own directory on the computer
3. you click on begin new index … it will ask if all files are closed … if yes, click continue
4. pick your directory using the little “…” button and give the “index” file a name
5. pick your images (you can use the control button to pick multiples
6. hang onto your hat and hold your breath because before you need to breath again you’ll have images each in their own html file with an index file

= V5 MultiLine NoSorting TabWidth=30

H=";ImageWrap - One Click"
==========================================
Adapted from an original by Joe Barta jbarta a-t apk d-o-t net
http://junior.apk.net/~jbarta/image-wrap/
==========================================

Convert a group of images into a suite of HTML pages linked from a
single index page. The index file Mmust be created in a directory
above (or in the same directory as) the images.

Close all NoteTab files before running this clip.

You can customise the HTML files by digging into the clips "_wrapper"
and "_index".

H="Begin new index"
^!Continue Are all files closed? If not - cancel and save, then restart.
^!Save As ^?[(T=S;F="All Files (*.*)|*.*")Name and path for index file=piclist.html]
^!Set %bgcolor%=^?[Background color (select or enter your own hex code)=_FFFFFF (White)^=FFFFFF|000000 (Black)^=000000]
^!Set %txtcolor%=^?[Text color (select or enter your own hex code)=FFFFFF (White)^=FFFFFF|_000000 (Black)^=000000]
^!Set %doc_title%=^?[Set a title for HTML files? (leave blank for none)=Image collection]
^!SetWordWrap Off

:ImageSelect
^!Jump TEXT_END
^?{(T=O;S=M;F="Image files (*.gif;*.jpg;*.png)|*.gif;*.jpg;*.png")Select files to be indexed:}

; Make item-per-line list removing semi-colons or quotes
^!SetCursor 1:1
^!Replace ; ^P ATIWS
^!SetCursor 1:1
^!Replace " ATIWS
^!Skip Image list complete?
^!Goto ImageSelect

^!SetScreenUpdate Off
;get the base path of the file list
^!Set %base_path%=^$GetPath(^$GetDocName$)$
;get the name of file
^!Set %base_name_1%=^$GetFileName(^$GetDocName$)$
;get the total lines and initialize line count
^!Set %total_lines%=^$GetLineCount$
^!Set %current_line_number%=1
;Set up a pasteboard
^!ToolBar New Document

; go to loop
^!Clip "operate"

; tidy up on return
;kill the pasteboard
^!Document LAST
^!DestroyDoc

;now we're at the file list
^!SetCursor 1:1
^!Select ALL
^!Clip "index"

^!ToolBar Save Document
^!Prompt All done!

H="_operate"
^!SetWordWrap Off
^!Document FIRST
^!SetCursor ^%current_line_number%:1
^!Select EOL
^!ToolBar Copy

; grab image particulars
^!Set %full_disk_path%=^$GetClipboard$
^!Set %img_width%=^$GetImgWidth(^$GetClipboard$)$
^!Set %img_height%=^$GetImgHeight(^$GetClipboard$)$
^!Set %image_name%=^$GetName(^$GetClipboard$)$
^!Set %image_ext%=^$GetExt(^$GetClipboard$)$

;get the relative disk & web path of the image to the file list
^!Document NEXT
^!ToolBar Clear All
^!InsertText ^%full_disk_path%
^!SetCursor 1:1
^!Replace ^%base_path% ATIWS
^!SetCursor 1:1
^!Replace / ATIWS
^!SetCursor 1:1
^!Select EOL
^!ToolBar Cut
^!Set %relative_web_path%=^$GetClipboard$

; build a save as filename out of the full_disk_path
^!ToolBar Clear All
^!SetCursor 1:1
^!InsertText ^%full_disk_path%
^!SetCursor 1:1
^!Replace .gif _gif ATIWS
^!SetCursor 1:1
^!Replace .jpg _jpg ATIWS
^!SetCursor 1:1
^!Replace .png _png ATIWS
^!SetCursor 1:1
^!Select EOL
^!ToolBar Cut
^!Set %full_disk_html_path%=^$GetClipboard$.html

; build a href out of the relative web path
^!ToolBar Clear All
^!SetCursor 1:1
^!InsertText ^%relative_web_path%
^!SetCursor 1:1
^!Replace .gif _gif ATIWS
^!SetCursor 1:1
^!Replace .jpg _jpg ATIWS
^!SetCursor 1:1
^!Replace .png _png ATIWS
^!SetCursor 1:1
^!Select EOL
^!ToolBar Cut
^!Set %href_html_path%=^$GetClipboard$.html

;make a nifty wrapper file
^!ToolBar New Document
^!Clip "wrapper"
^!Save As ^%full_disk_html_path%
^!ToolBar Close Document

^!Set %link%=<LI><A HREF="^%href_html_path%">^%image_name%
(^%image_ext%)</A></LI>
;go to the list and insert the link in place of the existing line
^!Document FIRST
^!SetCursor ^%current_line_number%:1
^!Select EOL
^!ToolBar Cut
^!InsertText ^%link%

; Stop when line count gets to the end of the list
^!Set %current_line_number%=^$Calc(^%current_line_number%+1;0)$
^!IF ^%current_line_number%=^%total_lines% EXIT

^!Clip "operate"

:EXIT

H="_wrapper"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>^%doc_title%</title>
<!-- Created with ImageWrap
    http://junior.apk.net/~jbarta/image-wrap/
    as modified by don from http://htmlfixit.com
    and fortiter at gmail dot com
    -->
<style type="text/css">
<!--
body {background-color:#^%bgcolor%;}
h2, li, li a {color:#^%txtcolor%;}
-->
</style>
</head>

<body>

<center>
<img src="^%image_name%^%image_ext%"
    width="^%img_width%"
    height="^%img_height%"
    alt="^%image_name%"
    border="0" />

    <p><a href="^%base_name_1%">Return to Image Menu</a></p>
</center>

</body>
</html>

H="_index"
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>^%doc_title%</title>
<!-- Created with ImageWrap
    http://junior.apk.net/~jbarta/image-wrap/
    as modified by don from http://htmlfixit.com
    and fortiter at gmail dot com
    -->
<style type="text/css">
<!--
body {background-color:#^%bgcolor%;}
h2, li, li a {color:#^%txtcolor%;}
-->
</style>
</head>

<body>

<h2>^%doc_title%</h2>
<ul>
^&
</ul>
</body>
</html>

Leave a Reply

Recent Posts

Archives

Topics