ImagePlugin does not update new images attached to a topic.
E.g. if a new version of screenshot is uploaded by a user, the resized image within the topic (created by
ImagePlugin) remains with the old image.
--
TWiki:Main/CedricWeber
- 27 Jun 2007
Sounds like
ImagePlugin could do with an attachhandler.
--
TWiki:Main.SteffenPoulsen
- 16 Sep 2007
I've just come across this bug. I've written a patch. Note that the patch uses TWiki::Func::getPubDir(), which is deprecated. It's currently a bit of a hack: I'm not sure what extensions
ImagePlugin allows, so I just put the popular ones in there for the regex. As it does an unlink: use at your own risk
sub afterAttachmentSaveHandler {
# do not uncomment, use $_[0], $_[1]... instead
### my( $attrHashRef, $topic, $web ) = @_;
forceImageThumbnailRefresh($_[1], $_[2]);
}
# CFLEWIS | 2008-04-10 | Force a refresh of an image thumbnail by
# deleting the thumbnail.
sub forceImageThumbnailRefresh
{
my $topic = shift;
my $web = shift;
my $path = TWiki::Func::getPubDir() . "/" . $web . "/" . $topic . "/";
opendir(ATTACHDIR, $path);
my @files = readdir(ATTACHDIR);
closedir(ATTACHDIR);
foreach my $taintedFile (@files)
{
my $file;
if ($taintedFile =~ m/(.*)/)
{
$file = $1;
}
if ($file =~ m/^_(\d*)___(.*)\.(jpg|png|gif|tif)$/)
{
# CFLEWIS | 2008-04-10 | Image plugin wrote this
unlink $path . $file;
}
}
}
--
TWiki:Main.ChrisFLewis
- 10 Apr 2008