File: lowsrc.src

package info (click to toggle)
wml 2.0.12ds1-8
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 3,432 kB
  • ctags: 116
  • sloc: perl: 5,634; sh: 3,663; makefile: 1,004
file content (73 lines) | stat: -rw-r--r-- 1,549 bytes parent folder | download | duplicates (5)
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
##
##  wml::des::lowsrc - Create Image and LOWSRC-Attribute for IMG-Tag
##  Copyright (c) 1997-2001 Ralf S. Engelschall, All Rights Reserved. 
##

#use wml::std::tags

<define-tag lowsrc>
<perl>
{
    my $src;
    <perl:assign:sq $src>%0</perl:assign:sq>
    my $lowsrc = $src;
    $lowsrc =~ s|\.([^.]+)$|.lowsrc.$1|;
    if (not -f $src) {
        print STDERR "wml::des::lowsrc, Error: Image `$src' not found\n";
    }
    my $skip = 0;
    if (-f $lowsrc) {
        $skip = 1 if ((stat($src))[9] <= (stat($lowsrc))[9]);
    }
    if (not $skip) {
        my $error = `convert -monochrome $src $lowsrc`;
        if ($? >> 8) {
            print STDERR "** wml::des::lowsrc:\n$error";
            exit(1);
        }
    }
    <perl:print> lowsrc="$lowsrc"</perl:print>
}
</perl>
</define-tag>

##EOF##
__END__

=head1 NAME

wml::des::lowsrc - Create Image and LOWSRC-Attribute for IMG-Tag

=head1 SYNOPSIS

 #use wml::des::lowsrc

 <img ...src="image.ANY" <lowsrc "image.ANY"> ...>

=head1 DESCRIPTION

This creates an F<image.lowsrc.ANY> file out of the F<image.ANY> one
containing only a monochrome bitmap (black/white) of the image's content and
prints out the corresponding C<lowsrc="image.lowsrc.gif"> string.

This include file needs the external program F<convert> from the
I<ImageMagick> package which can be found on
http://www.wizards.dupont.com/cristy/.

=head1 AUTHOR

 Ralf S. Engelschall
 rse@engelschall.com
 www.engelschall.com

=head1 REQUIRES

 Internal: P1, P2, P3
 External: convert (PATH)

=head1 SEE ALSO

ImageMagick

=cut