-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwatermark.pl
executable file
·29 lines (26 loc) · 1000 Bytes
/
watermark.pl
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
#!/usr/bin/perl
use Switch;
$|=1;
$count = 0;
$pid = $$;
while (<>) {
chomp $_;
if ($_ =~ /(.*\.jpg)/i) {
$url = $1;
system("/usr/bin/wget", "-q", "-O","/var/www/images/$pid-$count.jpg", "$url");
$img = "/var/www/images/$pid-$count.jpg";
system("/usr/bin/composite", "-dissolve", "50%", "-gravity", "center", "/tmp/jeremie.jpg", "$img", "$img");
print "http://127.0.0.1/images/$pid-$count.jpg\n";
}
elsif ($_ =~ /(.*\.png)/i) {
$url = $1;
system("/usr/bin/wget", "-q", "-O","/var/www/images/$pid-$count.png", "$url");
$img = "/var/www/images/$pid-$count.png";
system("/usr/bin/composite", "-dissolve", "50%", "-gravity", "center", "/tmp/jeremie.jpg", "$img", "$img");
print "http://127.0.0.1/images/$pid-$count.png\n";
}
else {
print "$_\n";;
}
$count++;
}