diff options
author | Yorhel <git@yorhel.nl> | 2011-08-22 09:37:52 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2011-08-22 09:37:52 +0200 |
commit | 3e50a783a073ba8359b221f7d9a8071e23ade967 (patch) | |
tree | ad6c8e9277bf31c3dda7fb09d45283c8426f5d5e /lib/VNDB/Func.pm | |
parent | 6ff624ccffc043141d33884dcc75d015e924d5d4 (diff) |
Use generic imgurl() and imgpath() functions to generate image URLs/paths
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; |