Gossamer Forum
Home : Products : DBMan : Customization :

Multi-Upload, Long/Short, Split image files for t-nail

Quote Reply
Multi-Upload, Long/Short, Split image files for t-nail
I must be crazy, am I the only one that needs to do this?

I'm trying to use the multi file upload mod to upload 2 graphics with each record. I want to use the first graphic on the short display as a thumb nail, and then use the other graphic (same but larger) on the long display. Similar to a common shopping cart layout.

The problem is that I can't seem to split up the two graphic files, I try to print just one and they both show up!

I've searched these posts for 2 days and I just haven't found anything that does it!

Any help would be so greatly appreciated.
-Tony
Quote Reply
Re: [Difrizznad] Multi-Upload, Long/Short, Split image files for t-nail In reply to
Yes this can be done, I got this working.

Use something like this in your html.pl sub html_record where you want the graphics displayed.


Code:
if ($rec{'Graphic'} eq 'Yes') {
opendir (GRAPHIC, "$SAVE_DIRECTORY/$rec{$db_key}") or &cgierr("unable to open directory:
$SAVE_DIRECTORY/$rec{$db_key}. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
@photo = qw();
foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
++$num_files;
push(@photo, $file);
}

print qq| <a href="$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[0]" target="_blank"><img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[0]" width="150" border="0"></a><br>
<$font1><a href="$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[0]" target="_blank">click photo to enlarge</a></font><br><br>
|;
}

Use something like this in your html.pl sub html_record_long where you want the graphic displayed.

Code:
if ($rec{'Graphic'} eq 'Yes') {
opendir (GRAPHIC, "$SAVE_DIRECTORY/$rec{$db_key}") or &cgierr("unable to open directory:
$SAVE_DIRECTORY/$rec{$db_key}. Reason: $!");
@files = readdir(GRAPHIC);
closedir (GRAPHIC);
@photo = qw();
foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
++$num_files;
push(@photo, $file);
}

print qq| <a href="$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[1]" target="_blank"><img src= "$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[1]" width="150" border="0"></a><br>
<$font1><a href="$SAVE_DIRECTORY_URL/$rec{$db_key}/$photo[1]" target="_blank">click photo to enlarge</a></font><br><br>
|;
}

This will make the first graphic uploaded from your form [0], second [1], etc..

Using a width value and no height value with the img tags will resize your graphic proportionaly.

Thanks for the code above, I cant remember who`s threads helped make this..

chmod
Quote Reply
Re: [Difrizznad] Multi-Upload, Long/Short, Split image files for t-nail In reply to
chmod,

Thanks a million, that was absolutely what I needed to make this happen! I messed around with this for 2 days, your code fixed it in about 2 minutes!

-Tony