At info@example.com vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea
 Home  Home  Home  Contact  Contact  Contact  Stuff  Stuff  Stuff
 Blog  Blog  Blog  FAQ  FAQ  FAQ

Code highlighting

 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
#!/usr/bin/perl

##############################################################################
#
use strict;

while(<@ARGV>) {
  my $my_dir = $_;
  die("$!") if (not -d $my_dir);
  chdir $my_dir or die("$!");
  #if (not -d "thumbs") {mkdir("thumbs") or die("$!");}

  my $my_ext_regex = "jpg|png|gif|svg";
  while (glob("*.jpg *.png *.gif")) {  # fix svg later
    my $my_pic = $_;
    next if $my_pic =~ m/-thumb\.($my_ext_regex)$/i;
    my ($my_ext) = ($my_pic =~ m/\.($my_ext_regex)$/i);
    my $my_thumb = "$my_pic";
    $my_thumb =~ s/\.($my_ext_regex)$/-thumb.\1/i;
    $my_ext =~ s/jpg$/jpeg/i;
    system("convert -define $my_ext:size=500x180 $my_pic -auto-orient -thumbnail 250x90 -unsharp 0x.5 $my_thumb \n");
  }

  my $our_cmd = "
  for file in *.jpg *.png *.gif *.svg; do
    if [ -e \$file ]; then
      set \$(identify \"\$file\")
      echo \$file \$3
    fi
  done
  ";
   
  open INPUT, "$our_cmd |" or die("$!");
  printf "{\{< heg-load-photoswipe >}\}\n";
  printf "{\{< heg-gallery title=\"$my_dir\" caption-effect=\"none\" hover-effect=\"grow\" >}\}\n";
  while(<INPUT>) {
    my ($my_file, $my_size) = split;
    next if $my_file =~ m/-thumb\.($my_ext_regex)$/i;
    printf "{\{< heg-figure thumb=\"%s\" link=\"%s\" size=\"%s\" >}\}\n", "-thumb", "/$my_dir$my_file", "$my_size";
  }
  printf "{\{< /heg-gallery >}\}\n";
  close INPUT;

}
Copyright © 2018, lobortis nisl ut aliquip ex ea commodo consequat
created with Hugo 0.40.1