Gossamer Forum
Home : Products : DBMan : Customization :

Put an image in a field

Quote Reply
Put an image in a field
First, pardon for my poor english.
My question is I need to be able to add an image as a field and when someone saws this record the image will be displayed. It has a way to to it with DBman?
Quote Reply
Re: Put an image in a field In reply to
Although I have not done this myself, I believe the following should work.

First make a field in your database (XXX.cfg file) that will hold the URL for the image you want displayed eg(www.testing.com/images/test.gif).

Now in the html.pl file you need to modify the html_record subroutine.
Wherever you want to display the image place the following code:

Code:
print qq|
<IMG src="http://$rec{'image'}">|;

You must consider picture size, as it will affect the form layout. You could add other fields to the database that describe attributes of the image file, like an ALT value, etc.

Note that changing the html_record subroutine will only display the image when the record is viewed from a search. Images will not show while searching, modifying, etc. records, because that view is controlled by the html_record_form subroutine.

Remember that if you change the location of the image file using this system, you must change the path entry in the database.

Sincerely,
Lauren Stegman