Thread Verzeichnisnamen hashen für Bilder
(19 answers)
Opened by jan99 at 2014-09-12 11:29 Code (perl): (dl
)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 use Digest::SHA qw(sha1_hex); local $/ = undef; my $wiki_code = <DATA>; $wiki_code =~ s/(\[\[Image:)(.+)\/(.+)(\]\])/"$1".sha1_hex($2)."_$3$4"/ge; print $wiki_code; __DATA__ [[Image:Vermessungspunkte-Dateien/image021.jpg]] [[Image:Vermessungspunkte-Dateien/image028.jpg]] Marker: [[Image:Vermessungspunkte-Marker/image011.jpg]] ergibt: [[Image:753ec701964f08b7f95237d548d87c9a0074a5d5_image021.jpg]] [[Image:753ec701964f08b7f95237d548d87c9a0074a5d5_image028.jpg]] Marker: [[Image:763439e8641fe76c5b5c364ce2dc922060032661_image011.jpg]] |