Gossamer Forum
Quote Reply
Image upload space issue
Hello all,

I am using global imageurl to let people upload their logo or image as needed. I am running into people who do not know how to properly format an image name. (no spaces). SO when someone uploads an image with a space in the name the image does not shows up.

Does anyone have any suggestions on how to fix this issue?
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$location";

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$location~;
}
else
{
return "";
}
}
The form used:
<input class="text" type="file" id="Upload_Image" name="Upload_Image" value="" size="30">


Thanks for any help on this :)


Sandra Roussel
Chonsa Group Design - Fresh Start Housing

Last edited by:

SandraR: Feb 8, 2007, 9:19 PM
Subject Author Views Date
Thread Image upload space issue SandraR 5177 Feb 8, 2007, 9:17 PM
Thread Re: [SandraR] Image upload space issue
brewt 5085 Feb 8, 2007, 10:15 PM
Thread Re: [brewt] Image upload space issue
SandraR 5068 Feb 9, 2007, 8:25 PM
Thread Re: [SandraR] Image upload space issue
SandraR 5017 Feb 16, 2007, 10:45 AM
Thread Re: [SandraR] Image upload space issue
SandraR 5022 Feb 21, 2007, 8:02 AM
Post Re: [SandraR] Image upload space issue
brewt 4992 Feb 21, 2007, 1:53 PM
Thread Re: [SandraR] Image upload space issue
brewt 5026 Feb 21, 2007, 4:23 PM
Thread Re: [brewt] Image upload space issue
SandraR 4986 Mar 5, 2007, 9:48 AM
Thread Re: [SandraR] Image upload space issue
brewt 4960 Mar 5, 2007, 2:36 PM
Thread Re: [brewt] Image upload space issue
SandraR 4955 Mar 5, 2007, 2:43 PM
Thread Re: [SandraR] Image upload space issue
brewt 4957 Mar 5, 2007, 4:03 PM
Post Re: [brewt] Image upload space issue
SandraR 4954 Mar 5, 2007, 4:47 PM
Thread Re: [SandraR] Image upload space issue
brewt 4960 Mar 5, 2007, 5:49 PM
Post Re: [brewt] Image upload space issue
SandraR 4902 Mar 13, 2007, 5:17 PM