File: Section_7.html

package info (click to toggle)
album 4.18-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 3,324 kB
  • sloc: perl: 5,506; makefile: 2
file content (543 lines) | stat: -rw-r--r-- 24,996 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543

<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html>
<head>
	<meta http-equiv='Content-Language' content='en'>
	<link rel='alternate' type='text/html' href='de/Section_7.html' hreflang='de' lang='de' title='album documentation'>
	<link rel='alternate' type='text/html' href='es/Section_7.html' hreflang='es' lang='es' title='album documentation'>
	<link rel='alternate' type='text/html' href='fr/Section_7.html' hreflang='fr' lang='fr' title='album documentation'>
	<link rel='alternate' type='text/html' href='nl/Section_7.html' hreflang='nl' lang='nl' title='album documentation'>
	<link rel='alternate' type='text/html' href='ru/Section_7.html' hreflang='ru' lang='ru' title='album documentation'>
	<link rel='alternate' type='text/html' href='it/Section_7.html' hreflang='it' lang='it' title='album documentation'>
	<link rel='alternate' type='text/html' href='hu/Section_7.html' hreflang='hu' lang='hu' title='album documentation'>


  <title>MarginalHacks album - Plugins, Usage, Creation,..
 - Documentation</title>

  <link rel='shortcut icon' HREF='/favicon.ico' type='image/x-gif'>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <style>
  <!--
  code {color: red;}
  tt {color: #ff6666;}
  A:hover {background-color: yellow;}
  -->
  </style>
  <script language='JavaScript'>
  <!--
  ver4 = (document.layers || document.all) ? 1 : 0;

  if (document.images) {
    ImageArray = new Array (
      'http://DavePics.com/Domains/MarginalHacks.gif',
      'http://DavePics.com/Domains/MarginalHacks_down.gif',
      'http://DavePics.com/Domains/GetDave.gif',
      'http://DavePics.com/Domains/GetDave_down.gif',
      'http://DavePics.com/Domains/Daveola.gif',
      'http://DavePics.com/Domains/Daveola_down.gif',
      'http://DavePics.com/Domains/DaveSource.gif',
      'http://DavePics.com/Domains/DaveSource_down.gif' )

    ImageList = new Array ();
    for (counter in ImageArray) {
      ImageList[counter] = new Image();
      ImageList[counter].src = ImageArray[counter];
    }
  };
  defaultStatus = 'Marginal Hacks'

  //-->
  </script>
</head>

<body bgcolor=white link='#0000FF' alink='#0000FF' vlink='#5000FF' text='#000000'>

<div lang='en'>
<center>
<table border=0 cellspacing=0 cellpadding=0 width=100%>
  <tr> <td rowspan=2>
      <a href='http://MarginalHacks.com/'
         onMouseOver = document.images['MarginalHacks'].src='http://DavePics.com/Domains/MarginalHacks_down.gif'
          onMouseOut = document.images['MarginalHacks'].src='http://DavePics.com/Domains/MarginalHacks.gif'
         onMouseDown = document.images['MarginalHacks'].src='http://DavePics.com/Domains/MarginalHacks_down.gif'
           onMouseUp = document.images['MarginalHacks'].src='http://DavePics.com/Domains/MarginalHacks.gif'>
      <img name=MarginalHacks alt='MarginalHacks.com'
           src='http://DavePics.com/Domains/MarginalHacks.gif'
           width=69 height=60 border=0></a>
      <a href='http://DaveSource.com/'
         onMouseOver = document.images['DaveSource'].src='http://DavePics.com/Domains/DaveSource_down.gif'
          onMouseOut = document.images['DaveSource'].src='http://DavePics.com/Domains/DaveSource.gif'
         onMouseDown = document.images['DaveSource'].src='http://DavePics.com/Domains/DaveSource_down.gif'
           onMouseUp = document.images['DaveSource'].src='http://DavePics.com/Domains/DaveSource.gif'>
      <img name=DaveSource alt='DaveSource.com'
           src='http://DavePics.com/Domains/DaveSource.gif'
           width=69 height=60 border=0></a>
      <a href='http://GetDave.com/'
         onMouseOver = document.images['GetDave'].src='http://DavePics.com/Domains/GetDave_down.gif'
          onMouseOut = document.images['GetDave'].src='http://DavePics.com/Domains/GetDave.gif'
         onMouseDown = document.images['GetDave'].src='http://DavePics.com/Domains/GetDave_down.gif'
           onMouseUp = document.images['GetDave'].src='http://DavePics.com/Domains/GetDave.gif'>
      <img name=GetDave alt='GetDave.com - all the current Dave Pointers.'
           src='http://DavePics.com/Domains/GetDave.gif'
           width=69 height=60 border=0></a>
      <a href='http://Daveola.com/'
         onMouseOver = document.images['Daveola'].src='http://DavePics.com/Domains/Daveola_down.gif'
          onMouseOut = document.images['Daveola'].src='http://DavePics.com/Domains/Daveola.gif'
         onMouseDown = document.images['Daveola'].src='http://DavePics.com/Domains/Daveola_down.gif'
           onMouseUp = document.images['Daveola'].src='http://DavePics.com/Domains/Daveola.gif'>
      <img name=Daveola alt='Daveola.com - My home.'
           src='http://DavePics.com/Domains/Daveola.gif'
           width=69 height=60 border=0></a>
  </td>
  <td bgcolor=#000000 align=right>
  <font size=+2 face='lucida, helvetica' color=#ccccc0>
    A&nbsp;l&nbsp;b&nbsp;u&nbsp;m&nbsp;<br>

    S&nbsp;e&nbsp;v&nbsp;e&nbsp;n&nbsp; &nbsp;-&nbsp;-&nbsp; &nbsp;P&nbsp;l&nbsp;u&nbsp;g&nbsp;i&nbsp;n&nbsp;s&nbsp;,&nbsp; &nbsp;U&nbsp;s&nbsp;a&nbsp;g&nbsp;e&nbsp;,&nbsp; &nbsp;C&nbsp;r&nbsp;e&nbsp;a&nbsp;t&nbsp;i&nbsp;o&nbsp;n&nbsp;,&nbsp;.&nbsp;.&nbsp;
<br>

  </font>
  </td></tr>
	<tr height=16>
		<td height=16 align=right>
			<a href="http://del.icio.us/post?url=http://MarginalHacks.com/Hacks/album/&amp;title=Marginal+Hacks+Photo+Album+Generator" class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Add 'Marginal Hacks Photo Album Generator' to Del.icio.us"><img src="/Bookmarks/delicious.gif" title="Add 'Marginal Hacks Photo Album Generator' to Del.icio.us" alt="Add 'Marginal Hacks Photo Album Generator' to Del.icio.us" border="0"></a>
			<a href="http://digg.com/software/Marginal_Hacks_Photo_Album_Generator" class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Digg 'Marginal Hacks Photo Album Generator'"><img src="/Bookmarks/digg.gif" title="Digg 'Marginal Hacks Photo Album Generator'" alt="Digg 'Marginal Hacks Photo Album Generator'" border="0"></a>
			<a href="http://furl.net/storeIt.jsp?t=Marginal+Hacks+Photo+Album+Generator&amp;u=http://MarginalHacks.com/Hacks/album/" class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Add 'Marginal Hacks Photo Album Generator' to FURL"><img src="/Bookmarks/furl.gif" title="Add 'Marginal Hacks Photo Album Generator' to FURL" alt="Add 'Marginal Hacks Photo Album Generator' to FURL" border="0"></a>
			<a href="http://reddit.com/submit?url=http://MarginalHacks.com/Hacks/album/&amp;title=Marginal+Hacks+Photo+Album+Generato" class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Add 'Marginal Hacks Photo Album Generator' to reddit"><img src="/Bookmarks/reddit.gif" title="Add 'Marginal Hacks Photo Album Generator' to reddit" alt="Add 'Marginal Hacks Photo Album Generator' to reddit" border="0"></a>
			<a href="http://www.stumbleupon.com/refer.php?url=http://MarginalHacks.com/Hacks/album/&amp;title=Marginal+Hacks+Photo+Album+Generator" class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Add 'Marginal Hacks Photo Album Generator' to Stumble Upon"><img src="/Bookmarks/stumbleupon.gif" title="Add 'Marginal Hacks Photo Album Generator' to Stumble Upon" alt="Add 'Marginal Hacks Photo Album Generator' to Stumble Upon" border="0"></a>
			<a href="http://www.technorati.com/faves?add=http://MarginalHacks.com/Hacks/album/" class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Add 'Marginal Hacks Photo Album Generator' to Technorati"><img src="/Bookmarks/technorati.gif" title="Add 'Marginal Hacks Photo Album Generator' to Technorati" alt="Add 'Marginal Hacks Photo Album Generator' to Technorati" border="0"></a>
			<a href="http://myweb2.search.yahoo.com/myresults/bookmarklet?u=http://MarginalHacks.com/Hacks/album/&amp;t=Marginal+Hacks+Photo+Album+Generator" class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Add 'Marginal Hacks Photo Album Generator' to Yahoo My Web"><img src="/Bookmarks/myweb2.gif" title="Add 'Marginal Hacks Photo Album Generator' to Yahoo My Web" alt="Add 'Marginal Hacks Photo Album Generator' to Yahoo My Web" border="0"></a>
			<a href="http://www.google.com/bookmarks/mark?op=edit&amp;output=popup&amp;bkmk=http://MarginalHacks.com/Hacks/album/&amp;title=Marginal+Hacks+Photo+Album+Generator" class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Add 'Marginal Hacks Photo Album Generator' to Google Bookmarks"><img src="/Bookmarks/google.gif" title="Add 'Marginal Hacks Photo Album Generator' to Google Bookmarks" alt="Add 'Marginal Hacks Photo Album Generator' to Google Bookmarks" border="0"></a>
			<a href="http://www.squidoo.com/lensmaster/bookmark?http://MarginalHacks.com/Hacks/album/" class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Add 'Marginal Hacks Photo Album Generator' to Squidoo"><img src="/Bookmarks/squidoo.gif" title="Add 'Marginal Hacks Photo Album Generator' to Squidoo" alt="Add 'Marginal Hacks Photo Album Generator' to Squidoo" border="0"></a>
			<a href="http://www.spurl.net/spurl.php?url=http://MarginalHacks.com/Hacks/album/&amp;title=Marginal+Hacks+Photo+Album+Generator" class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Add 'Marginal Hacks Photo Album Generator' to Spurl"><img src="/Bookmarks/spurl.gif" title="Add 'Marginal Hacks Photo Album Generator' to Spurl" alt="Add 'Marginal Hacks Photo Album Generator' to Spurl" border="0"></a>
			<a href="http://www.bloglines.com/sub/http://MarginalHacks.com/Hacks/album/" class="social_img" onclick="window.open(this.href, '_blank', 'scrollbars=yes,menubar=no,height=600,width=750,resizable=yes,toolbar=no,location=no,status=no'); return false;" title="Add 'Marginal Hacks Photo Album Generator' to Bloglines"><img src="/Bookmarks/bloglines.gif" title="Add 'Marginal Hacks Photo Album Generator' to Bloglines" alt="Add 'Marginal Hacks Photo Album Generator' to Bloglines" border="0"></a>
 	 </td>
	</tr>
</table>

<a name=top>

<table cellpadding=8 width='100%'> <tr>
  <td valign=top>
    <table>
      <tr bgcolor=#BBBBBB><td>
        <h3><a href='http://MarginalHacks.com/Hacks/album/'>Home</a>&nbsp;&nbsp;</h3>
        <p>
      </td></tr>
      <tr bgcolor=#BBBBBB><td>
        <h3><a href='http://MarginalHacks.com/Hacks/album/Themes.html'>Themes/Examples</a>&nbsp;&nbsp;</h3>
        <p>
      </td></tr>
      <tr bgcolor=#BBBBBB><td>
        <h3><a href='http://MarginalHacks.com/Hacks/album/Languages.html'>Languages</a>&nbsp;&nbsp;</h3>
        <p>
      </td></tr>
      <tr bgcolor=#BBBBBB><td>
        <h3><a href='http://MarginalHacks.com/Hacks/album/Plugins.html'>Plugins</a>&nbsp;&nbsp;</h3>
        <p>
      </td></tr>
      <tr bgcolor=#BBBBBB><td>
        <h3><a href='http://MarginalHacks.com/Hacks/album/License.html'>License</a>&nbsp;&nbsp;</h3>
        <p>
      </td></tr>
      <tr bgcolor=#BBBBBB><td>
        <h3><a href='http://MarginalHacks.com/Hacks/album/Download.html'>Download</a>&nbsp;&nbsp;</h3>
        <p>
      </td></tr>
      <tr bgcolor=#BBBBBB><td>
        <h3>Documentation
          <font size='-1'>
<br><span lang='en'>&nbsp;&nbsp; <img src="flag.png"> &nbsp;&nbsp;English</span>
<br><span lang='de'>&nbsp;&nbsp; <img src="de/flag.png"> &nbsp;&nbsp;<a href="de">Deutsch</a></span>
<br><span lang='es'>&nbsp;&nbsp; <img src="es/flag.png"> &nbsp;&nbsp;<a href="es">Español</a></span>
<br><span lang='fr'>&nbsp;&nbsp; <img src="fr/flag.png"> &nbsp;&nbsp;<a href="fr">Français</a></span>
<br><span lang='nl'>&nbsp;&nbsp; <img src="nl/flag.png"> &nbsp;&nbsp;<a href="nl">Nederlands</a></span>
<br><span lang='ru'>&nbsp;&nbsp; <img src="ru/flag.png"> &nbsp;&nbsp;<a href="ru">Русский</a></span>
<br><span lang='it'>&nbsp;&nbsp; <img src="it/flag.png"> &nbsp;&nbsp;<a href="it">Italiano</a></span>
<br><span lang='hu'>&nbsp;&nbsp; <img src="hu/flag.png"> &nbsp;&nbsp;<a href="hu">magyar</a></span>

          </font>
</h3>
        <p>
      </td></tr>
      <tr bgcolor=#BBBBBB><td>
        <h3><a href='http://MarginalHacks.com/Hacks/album/Mailing_List.html'>Mailing List</a>&nbsp;&nbsp;</h3>
        <p>
      </td></tr>
      <tr bgcolor=#BBBBBB><td>
        <h3><a href='http://MarginalHacks.com/Hacks/album/CHANGELOG.html'>CHANGELOG</a>&nbsp;&nbsp;</h3>
        <p>
      </td></tr>
      <tr bgcolor=#BBBBBB><td>
        <h3><a href='http://MarginalHacks.com/Hacks/album/Praises.html'>Praises</a>&nbsp;&nbsp;</h3>
        <p>
      </td></tr>
      <tr bgcolor=#BBBBBB><td>
        <h3><a href=/Contact/>Contact</a>&nbsp;&nbsp;</h3>
        <p>
      </td></tr>
    </table>
  </td>
  <td valign=top>



<p><hr><p>
<a href='.'>Table Of Contents</a>
<ol><li> <a href='#What_are_Plugins'>What are Plugins?</a>
 <li> <a href='#Installing_Plugins_and_plugin_support'>Installing Plugins and plugin support</a>
 <li> <a href='#Loading_Unloading_Plugins'>Loading/Unloading Plugins</a>
 <li> <a href='#Plugin_Options'>Plugin Options</a>
 <li> <a href='#Writing_Plugins'>Writing Plugins</a>
</ol><p><hr><p>


<pre>

<b><a name='What_are_Plugins'>1:</a>   What are Plugins?</b>

Plugins are snippets of code that allow you to modify the behavior
of album.  They can be as simple as a new way to create EXIF captions,
to something as complex as creating the album based on a database of
images instead of using the filesystem hierarchy.

<b><a name='Installing_Plugins_and_plugin_support'>2:</a>   Installing Plugins and plugin support</b>

There are a number of plugins available with the standard installation of
album.  If you are upgrading album with plugins from an earlier version
of album that did not have plugins (pre v3.10), you may need to once do:

<code>% album -configure</code>

You will not need to do this with future upgrades of album.

This will install the current plugins into one of the default
plugin directories - album will look for plugins in a number of
locations, the default locations are:
<tt>
  /etc/album/plugins/
  /usr/share/album/plugins/
  $HOME/.album/plugins/
</tt>
In reality, these are 'plugins' directories found in the set of
locations specified by '--data_path' - hence the defaults are:
<tt>
  /etc/album/
  /usr/share/album/
  $HOME/.album/
</tt>
You can specify a new location with --data_path and then add a 'plugins'
directory to that location, or use the --plugin_path option.

Plugins usually end with the ".alp" prefix, but you do not need
to specify this prefix when using plugins.  For example, if you
have a plugin installed at:

<tt>/etc/album/plugins/utils/mv.alp</tt>

Then you would specify the plugin as:  <tt>utils/mv</tt>

<b><a name='Loading_Unloading_Plugins'>3:</a>   Loading/Unloading Plugins</b>

To list all the currently installed plugins:

<code>% album -list_plugins</code>

To show information about a specific plugin (using 'utils/mv' as an example):

<code>% album -plugin_info utils/mv</code>

Plugins will be saved in the configuration for a given album, so
they don't need to be respecified every time (excluding one-time
plugins such as 'utils/mv')

You can use -no_plugin and -clear_plugin to turn off plugins that have
been saved in an album configuration.  As with <a href="Section_3.html#Options">normal album options,</a>
-no_plugin will turn off a specific plugin, and -clear_plugin will
turn off all plugins.  Any saved plugin options for that plugin will be
erased as well.

<b><a name='Plugin_Options'>4:</a>   Plugin Options</b>

A few plugins may be able to take command-line options, to view usage
for these plugins:

<code>% album -plugin_usage utils/mv</code>

But when specifying plugin options, you need to tell album which plugin
the option belongs to.  Instead of specifying as a normal album option:

<code>% album -some_option</code>

You prefix the option with the plugin name followed by a colon:

<code>% album -some_plugin:some_option</code>

For example, you can specify the generated 'index' created by
the 'utils/capindex' plugin.

<code>% album -plugin utils/capindex  -utils/capindex:index blah.html</code>

That's a bit unwieldy.  You can shorten the name of the plugin as
long as it doesn't conflict with another plugin you've loaded (by
the same name):

<code>% album -plugin utils/capindex  -capindex:index</code>

Obviously the other types of options (strings, numbers and arrays) are
possible and use the same convention.  They are saved in album configuration
the same as normal album options.

One caveat:  As mentioned, once we use a plugin on an album it is saved
in the configuration.  If you want to add options to an album that is
already configured to use a plugin, you either need to mention the plugin
again, or else use the full name when specifying the options (otherwise
we won't know what the shortened option belongs to).

For example, consider an imaginary plugin:

<code>% album -plugin some/example/thumbGen Photos/Spain</code>

After that, let's say we want to use the thumbGen boolean option "fast".
This will <b>not</b> work:

<code>% album -thumbGen:fast Photos/Spain</code>

But either of these will work:

<code>% album -plugin some/example/thumbGen -thumbGen:fast blah.html Photos/Spain</code>
<code>% album -some/example/thumbGen:fast Photos/Spain</code>

<b><a name='Writing_Plugins'>5:</a>   Writing Plugins</b>

Plugins are small perl modules that register "hooks" into the album code.

There are hooks for most of the album functionality, and the plugin hook
code can often either replace or supplement the album code.  More hooks
may be added to future versions of album as needed.

You can see a list of all the hooks that album allows:

<code>% album -list_hooks</code>

And you can get specific information about a hook:

<code>% album -hook_info &lt;hook_name&gt;</code>

We can use album to generate our plugin framework for us:

<code>% album -create_plugin</code>

For this to work, you need to understand album hooks and album options.

We can also write the plugin by hand, it helps to use an already
written plugin as a base to work off of.

In our plugin we register the hook by calling the album::hook() function.
To call functions in the album code, we use the <code>album</code> namespace.
As an example, to register code for the <code>clean_name</code> hook our plugin calls:

<code>album::hook($opt,'clean_name',\&my_clean);</code>

Then whenever album does a <code>clean_name</code> it will also call the plugin
subroutine called <code>my_clean</code> (which we need to provide).

To write <code>my_clean</code> let's look at the clean_name hook info:
<tt>
  Args: ($opt, 'clean_name',  $name, $iscaption)
  Description: Clean a filename for printing.
    The name is either the filename or comes from the caption file.
  Returns: Clean name
</tt>
The args that the <code>my_clean</code> subroutine get are specified on the first line.
Let's say we want to convert all names to uppercase.  We could use:
<tt>
sub my_clean {
  my ($opt, $hookname, $name, $iscaption) = @_;
  return uc($name);
}
</tt>
Here's an explanation of the arguments:

<b>$opt</b>        This is the handle to all of album's options.
            We didn't use it here.  Sometimes you'll need it if you
            call any of albums internal functions.  This is also true
            if a <b>$data</b> argument is supplied.
<b>$hookname</b>   In this case it will be 'clean_name'.  This allows us
            to register the same subroutine to handle different hooks.
<b>$name</b>       This is the name we are going to clean.
<b>$iscaption</b>  This tells us whether the name came from a caption file.
            To understand any of the options after the <b>$hookname</b> you
            may need to look at the corresponding code in album.

In this case we only needed to use the supplied <b>$name</b>, we called
the perl uppercase routine and returned that.  The code is done, but now
we need to create the plugin framework.

Some hooks allow you to replace the album code.  For example, you
could write plugin code that can generate thumbnails for pdf files
(using 'convert' is one way to do this).  We can register code for
the 'thumbnail' hook, and just return 'undef' if we aren't looking
at a pdf file, but when we see a pdf file, we create a thumbnail
and then return that.  When album gets back a thumbnail, then it
will use that and skip it's own thumbnail code.


Now let's finish writing our uppercase plugin.  A plugin must do the following:

<b>1)</b> Supply a 'start_plugin' routine.  This is where you will likely
   register hooks and specify any command-line options for the plugin.

<b>2)</b> The 'start_plugin' routine <b>must</b> return the plugin info
   hash, which needs the following keys defined:
   <i>author</i>      => The author name
   <i>href</i>        => A URL (or mailto, of course) for the author
   <i>version</i>     => Version number for this plugin
   <i>description</i> => Text description of the plugin

<b>3)</b> End the plugin code by returning '1' (similar to a perl module).

Here is our example <code>clean_name</code> plugin code in a complete plugin:

<hr>
sub start_plugin {
  my ($opt) = @_;

  album::hook($opt,'clean_name',\&my_clean);

  return {
    author => 'David Ljung Madison',
    href => 'http://MarginalHacks.com/',
    version => '1.0',
    description => "Conver image names to uppercase",
  };
}

sub my_clean {
  return uc($name);
}

1;
<hr>

Finally, we need to save this somewhere.  Plugins are organized in the
plugin directory hierarchy, we could save this in a plugin directory as:

  <tt>captions/formatting/NAME.alp</tt>

In fact, if you look in <tt>examples/formatting/NAME.alp</tt> you'll find that
there's a plugin already there that does essentially the same thing.

If you want your plugin to accept command-line options, use 'add_option.'
This <b>must</b> be done in the start_plugin code.  Some examples:
<tt>
  album::add_option(1,"fast",album::OPTION_BOOL, usage=>"Do it fast");
  album::add_option(1,"name", album::OPTION_STR, usage=>"Your name");
  album::add_option(1,"colors",album::OPTION_ARR, usage=>"Color list");
</tt>
For more info, see the 'add_option' code in album and see all of the uses
of it (at the top of album and in plugins that use 'add_option')

To read an option that the user may have set, we use option():
<tt>
  my $fast = album::option($opt, "fast");
</tt>
If the user gave a bad value for an option, you can call usage():
<tt>
  album::usage("-colors array can only include values [red, green, blue]");
</tt>
If your plugin needs to load modules that are not part of the
standard Perl distribution, please do this conditionally.  For
an example of this, see plugins/extra/rss.alp.

You can also call any of the routines found in the album script
using the album:: namespace.  Make sure you know what you are doing.
Some useful routines are:

<tt>
  album::add_head($opt,$data, "&lt;meta name='add_this' content='to the &lt;head&gt;'&gt;");
  album::add_header($opt,$data, "&lt;p&gt;This gets added to the album header");
  album::add_footer($opt,$data, "&lt;p&gt;This gets added to the album footer");
</tt>

The best way to figure out how to write plugins is to look at other
plugins, possibly copying one that is similar to yours and working
off of that.  Plugin development tools may be created in the future.

Again, album can help create the plugin framework for you:

<code>% album -create_plugin</code>


</pre>
<p><font size='-1'><li> Created by <a href='http://MarginalHacks.com/Hacks/make_faq/'>make_faq</a> from <a href='http://MarginalHacks.com/'>Marginal Hacks</a></font><p>
    </td>
  </tr>
</table>
</div>

</body>
</html>
<pre>

     ^
     |

     ^
     |

     ^
     |

     ^
     |

     ^
     |

     ^
     |

     ^
     |

     ^
     |

     ^
     |

     ^
     |

     ^
     |

     ^
     |

     ^
     |

     ^
     |

     ^
     |

     ^
     |

     ^
     |

     ^
     |

     ^
     |

     ^
     |
</pre>