Hello Adrian,
You are not going to believe it but I finally got it to work with one exception -- It still refuses to show up on the page.
When I modify the link and click View (Upload_Image download view Delete)
it shows up fine but the darned image still refuses to show up on the page, if you upload an image without the spaces it shows up fine.
global modified
my $field = shift;
my $tags = GT::Template->tags;
my $id = $tags->{ID};
if ($tags->{$field})
{
my $links_db = $DB->table('Links');
my $fh = $links_db->file_info( "$field", $id );
return "" unless($fh);
my $location = $fh->File_RelativePath;
my $logow = 75;
my $extra_atts="oriw=$tags->{LogoWidth}";
if($field eq "Logo" && $tags->{LogoWidth} ne "$logow"){
eval{
use Image::Magick;
};
$@ and return $@;
my $i= new Image::Magick();
my $if = $CFG->{build_root_path} . "/Upload_Image/";
my $error = $i->Read($if);
return "Could not read $if file. Reason:" . $error if $error;
my $w = $i->Get('width');
$extra_atts .= ";width =$w";
if($w ne "$logow"){
my $h = $i->Get('height');
my $logoh = int($h*($logow/$w));
$error = $i->Resize(geometry => "${logow}x$logoh", width => $logow, height => $logoh);
return "Could not read $if file. Reason:" . $error if $error;
$extra_atts .= ";height=$h";
my $rs = $i->Write($if);
}
$links_db->update({LogoWidth => $logow},{ID => $id}) if($tags->{LogoWidth} ne "$logow");
}
return qq~$CFG->{build_root_url}/Upload_Image/~;
}
else
{
return "";
}
}
Thanks for you help
Sandra Roussel
Chonsa Group Design - Fresh Start Housing
You are not going to believe it but I finally got it to work with one exception -- It still refuses to show up on the page.
When I modify the link and click View (Upload_Image download view Delete)
it shows up fine but the darned image still refuses to show up on the page, if you upload an image without the spaces it shows up fine.
global modified
Code:
sub { my $field = shift;
my $tags = GT::Template->tags;
my $id = $tags->{ID};
if ($tags->{$field})
{
my $links_db = $DB->table('Links');
my $fh = $links_db->file_info( "$field", $id );
return "" unless($fh);
my $location = $fh->File_RelativePath;
my $logow = 75;
my $extra_atts="oriw=$tags->{LogoWidth}";
if($field eq "Logo" && $tags->{LogoWidth} ne "$logow"){
eval{
use Image::Magick;
};
$@ and return $@;
my $i= new Image::Magick();
my $if = $CFG->{build_root_path} . "/Upload_Image/";
my $error = $i->Read($if);
return "Could not read $if file. Reason:" . $error if $error;
my $w = $i->Get('width');
$extra_atts .= ";width =$w";
if($w ne "$logow"){
my $h = $i->Get('height');
my $logoh = int($h*($logow/$w));
$error = $i->Resize(geometry => "${logow}x$logoh", width => $logow, height => $logoh);
return "Could not read $if file. Reason:" . $error if $error;
$extra_atts .= ";height=$h";
my $rs = $i->Write($if);
}
$links_db->update({LogoWidth => $logow},{ID => $id}) if($tags->{LogoWidth} ne "$logow");
}
return qq~$CFG->{build_root_url}/Upload_Image/~;
}
else
{
return "";
}
}
Thanks for you help
Sandra Roussel
Chonsa Group Design - Fresh Start Housing