hi,
this is not really a plugin but maybe helpful for
someone. we used this subroutine to save database
space and have a way to automatically add pictures
for each link in the database (product pictures for
our shop)
all you need is a path where you put your pictures .jpg or .gif and one image for no picture
saying something like: sorry no image yet.
We added this in a Module called Shop.pm but
you could insert it via the admin area in the globals either. then you have to call it:
<%Shop::get_picture('$ID')%>
sub get_picture {
my $path = "/path/where/you/put/your/images/";
my $url = "/path/for/img/src/";
my ($pic,$img,$pic2,$img2);
$pic = $path . $_[0].gif;
$img = "$_[0].gif";
$pic2 = $path . $_[0].jpg;
$img2 = "$_[0].jpg";
stat("$pic");
stat("$pic2");
if (-e $pic) {return qq~<img src="~ . $url . $img . qq~">\n~;}
elsif (-e $pic2) {return qq~<img src="~ . $url . $img2 . qq~">\n~;}
else {return "return qq~<img src="~ . $url . qq~noimage.gif">\n~;} #the name for your sorry image
}
hope someone can use this or has suggestions for
easier ways.
regards
niko
this is not really a plugin but maybe helpful for
someone. we used this subroutine to save database
space and have a way to automatically add pictures
for each link in the database (product pictures for
our shop)
all you need is a path where you put your pictures .jpg or .gif and one image for no picture
saying something like: sorry no image yet.
We added this in a Module called Shop.pm but
you could insert it via the admin area in the globals either. then you have to call it:
<%Shop::get_picture('$ID')%>
sub get_picture {
my $path = "/path/where/you/put/your/images/";
my $url = "/path/for/img/src/";
my ($pic,$img,$pic2,$img2);
$pic = $path . $_[0].gif;
$img = "$_[0].gif";
$pic2 = $path . $_[0].jpg;
$img2 = "$_[0].jpg";
stat("$pic");
stat("$pic2");
if (-e $pic) {return qq~<img src="~ . $url . $img . qq~">\n~;}
elsif (-e $pic2) {return qq~<img src="~ . $url . $img2 . qq~">\n~;}
else {return "return qq~<img src="~ . $url . qq~noimage.gif">\n~;} #the name for your sorry image
}
hope someone can use this or has suggestions for
easier ways.
regards
niko