diff options
Diffstat (limited to 'lib/VNDB/Func.pm')
-rw-r--r-- | lib/VNDB/Func.pm | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/lib/VNDB/Func.pm b/lib/VNDB/Func.pm index 67cd3f7e..a2cacf78 100644 --- a/lib/VNDB/Func.pm +++ b/lib/VNDB/Func.pm @@ -7,7 +7,10 @@ use TUWF ':html'; use Exporter 'import'; use POSIX 'strftime', 'ceil', 'floor'; use VNDBUtil; -our @EXPORT = (@VNDBUtil::EXPORT, qw| clearfloat cssicon tagscore mt minage fil_parse fil_serialize parenttags childtags charspoil |); +our @EXPORT = (@VNDBUtil::EXPORT, qw| + clearfloat cssicon tagscore mt minage fil_parse fil_serialize parenttags + childtags charspoil imgpath imgurl +|); # three ways to represent the same information @@ -180,5 +183,17 @@ sub charspoil { } +# generates a local path to an image in static/ +sub imgpath { # <type>, <id> + return sprintf '%s/%s/%02d/%d.jpg', $VNDB::ROOT, $_[0], $_[1]%100, $_[1]; +} + + +# generates a URL for an image in static/ +sub imgurl { + return sprintf '%s/%s/%02d/%d.jpg', $TUWF::OBJ->{url_static}, $_[0], $_[1]%100, $_[1]; +} + + 1; |