Gossamer Forum
Home : Products : DBMan : Customization :

Multiple Image Upload

Quote Reply
Multiple Image Upload
I have used the image upload mod and the multiple file upload mod. What I need is to be able to upload 5 images and then direct or call the placement of each image in a different location on the page or another page.

I have looked at JP Deni's pages and I can not get a clear picture of how to accomplish this.

Thanks for your help.

Tommy



Quote Reply
Re: Multiple Image Upload In reply to
How about in the html.pl file, where you would normally specifiy:

foreach $file (@files) {
next if ($file =~ /^\./); # Skip "." and ".." entries..
next if ($file =~ /^index/); # Skip index.htm type files..
print qq|<img src="$SAVE_DIRECTORY_URL/$rec{$db_key}/$file" border=0></td>|;
}


you change to:
print qq|<img src="$SAVE_DIRECTORY_URL/$rec{$db_key}/file1.jpg" border=0></td>|;

You then just make sure that each record has its files named file1, file2 etc. so you can reference them throughout the results page.

HTH. Brian

Quote Reply
Re: Multiple Image Upload In reply to
Thank You for the Help!

I'll give it a try.

Tommy

Quote Reply
Re: Multiple Image Upload In reply to
Is it possible to take the real File Names ?
How could we save the Names ?

Best regards
Christian

Quote Reply
Re: Multiple Image Upload In reply to
This is done with the file upload (add form)

Make sure we are talking about the same thing - I am referring to the multiple file upload mod.

Best regards, Brian

Quote Reply
Re: Multiple Image Upload In reply to
I also use the multiple file upload mod.

But the problem is that i have all 6 images at one block.
I also need different places in the html code for each image.


To change:
print qq|<img src="$SAVE_DIRECTORY_URL/$rec{$db_key}/file1.jpg" border=0></td>|;

is a good idea, but i you have different Editors of the Database, is not possible to teach them to rename the Files before uploading (File1.gif,File2.gif, ...)

Is it possible to save the original Filename in a Record Field at upload an then Include in the html Code:

print qq|<img src="$SAVE_DIRECTORY_URL/$rec{$db_key}/$rec{'image1')" border=0></td>|; and so on ?

I´m not able to implement the code for this in the sub add in db.cgi File.

can you do this ?

Best Regards
Christian

Sorry for my bavarian english ;-)


Quote Reply
Re: Multiple Image Upload In reply to
You need to read up on handling arrays in perl.

In html.pl, the file-upload mod opens the upload_dir and reads
the filenames into an array called @files. You can therefore reference each file by $file.
Obviously you need some way of consistently ordering the arrary which is why I suggest
numbering the files. Whatever method you choose, all users will need to use the same
nameing system.

HTH, Brian

Quote Reply
Re: Multiple Image Upload In reply to
I have now realized a little workaround.

I add 6 Fields (Image1- Image6) and add

print qq|
<TR><TD>Bild laden:</TD><TD><INPUT TYPE="Text" NAME="Image$u" SIZE="30"></TD>
<TD align="left"><INPUT TYPE="FILE" NAME="file-to-upload-$u" SIZE="30"></TD></TR>|;
to the Record Layout.

Every Time i upload a Image, i type in the name of the Image into a 2nd Field. ;-)