line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Template::Plugin::Thumbalizr; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
66897
|
use 5.016003; |
|
1
|
|
|
|
|
3
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
31
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
7
|
use base 'Template::Plugin'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
591
|
|
8
|
1
|
|
|
1
|
|
5827
|
use WebService::Thumbalizr; |
|
1
|
|
|
|
|
136768
|
|
|
1
|
|
|
|
|
182
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '1.0.0'; |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=head1 NAME |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Template::Plugin::Thumbalizr - A Thumbalizr (https://thumbalizr.com) plugin for Template::Toolkit. This allows you to easily embed live screenshots into your website. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 SYNOPSIS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
[% USE thumbalizr = Thumbalizr('api_key', 'secret') %] |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=head1 DESCRIPTION |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
Thumbalizr (L) is a web service to easily embed live screenshots of any URL in your website. Thumbalizr has full support for Flash, JavaScript, CSS, & HTML5. |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
The latest API version is detailed at L. WebService::Thumbalizr. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
The source code is available on github at L. |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=head1 METHODS |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
=over 4 |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
=head2 new() |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
[% USE thumbalizr = Thumbalizr('api_key', 'secret') %] |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Initialize the Thumbalizr plugin. You must pass your API secret (login to your Thumbalizr account to display your secret). |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
Arguments: |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=over 4 |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=item api_key |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
Required. Embed API key. |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
=item secret |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Required. Thumbalizr secret. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=back |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=cut |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub new { |
60
|
0
|
|
|
0
|
1
|
|
my ($class, $context, $api_key, $secret) = @_; |
61
|
|
|
|
|
|
|
|
62
|
0
|
0
|
|
|
|
|
return $class->fail("API key missing") |
63
|
|
|
|
|
|
|
unless $api_key; |
64
|
|
|
|
|
|
|
|
65
|
0
|
0
|
|
|
|
|
return $class->fail("Secret missing") |
66
|
|
|
|
|
|
|
unless $secret; |
67
|
|
|
|
|
|
|
|
68
|
0
|
|
|
|
|
|
my $thumbalizr = WebService::Thumbalizr->new(key => $api_key, secret => $secret); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
bless { |
72
|
|
|
|
|
|
|
_CONTEXT => $context, |
73
|
|
|
|
|
|
|
_thumbalizr => $thumbalizr, |
74
|
|
|
|
|
|
|
}, $class; |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head2 url() |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Display the URL of the Thumbalizr screenshot. You cna use it as the src attribute of your img tag. |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
Arguments: |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=over 4 |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=item url |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Required. URL of the website to create a screenshot of. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=back |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
|
|
|
|
|
|
sub url { |
97
|
0
|
|
|
0
|
1
|
|
my ($self, $url, %args) = @_; |
98
|
|
|
|
|
|
|
|
99
|
0
|
|
|
|
|
|
return $self->{_thumbalizr}->url($url, %args); |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
1; |
104
|
|
|
|
|
|
|
__END__ |