Gossamer Forum
Home : Products : DBMan : Customization :

Uploading and displaying images

Quote Reply
Uploading and displaying images
I am building a system that keeps information about people. It is crucial that I give customers the chance to upload their photographs. I would like to know how I could achieve this, and show their pic with their record once they have uploaded the file. Thanks for this help, and if it is possible, I'd like to find a way to check the images before they can be viewed by other customers.
Quote Reply
Re: Uploading and displaying images In reply to
Several ways to do it. Seems like you have at least 3 issues. 1. Making the photo available with the record. 2. Having customers upload the photo and 3. You reviewing the photo prior to going online.

I'll address only number one: the way I do it is to have a field in the record for the name of the photo. Then in the html which is generated I use: <IMG SRC="../../../photos/$rec{'Photo2'}" BORDER=0 > where ../../../photos is the directory where the photos are uploaded to on the server and $rec{'Photo2'} is the name of the field in the record where the customer or whomever inputs the name of the photo file. Works well for me.

You can have the customer input the name of his/her photo and it will be displayed however you format the record for display.

If you want to review the photo first, I suggest you create another directory for upload where you can review and then transfer the photo once approved to the directory that the html points to.
Quote Reply
Re: Uploading and displaying images In reply to
I have just written a modification that will allow users to upload a graphic file when they add a record. I'm not really advertising it yet, because I'd like to know who has it and if they have any problems with it before I go on. If you're interested, write to me at deni@jpdeni.com and I'll let you know how to get the mod.

As for your previewing it before it is available for all to see, you could have a "Validated" field that would be admin only and set to "No" by default. Then you could come in and do a search for all records that have "No" in the "Validated" field, check out that the record and graphic are okay, and change the "Validated" field to "Yes."

To prevent others from seeing unvalidated records, add a hidden field on your search form:
<input type="hidden" name="Validated" value="Yes">



------------------
JPD





Quote Reply
Re: Uploading and displaying images In reply to
Your advice about hidden field for checking validation seems great. But I would like to allow people to view unvalidated records, although I would not show the unvalidated field, that is, the image. Guess I could achieve that with an IF ... THEN using this validation field.
I'm interested in the modification, already emailed JPdeni
Quote Reply
Re: Uploading and displaying images In reply to
Okay. You can do that, too.

In html_record, where the graphic would display, use

if ($rec{'Validated'} eq "Yes") {
[print out graphic]
}

I got two requests for the graphic upload mod. I'm assuming one of them was yours. Smile The links to pick up the files have been sent.


------------------
JPD





Quote Reply
Re: Uploading and displaying images In reply to
I'm not sure. I don't think I've heard back from everyone.


------------------
JPD





Quote Reply
Re: Uploading and displaying images In reply to
JPD - was anyone else who requested your "mod" sucessful in getting it to work?

Donm
Quote Reply
Re: Uploading and displaying images In reply to
Well, I'm proud to tell you that it has worked fine for me. Thanks Carol, you have been great. I would have dumped DBMan if it wasn't for your help. The only little bug that I see is that you can click the upload image button when the field is blank and that takes you to the upload success page. But I think that bug is no big deal.
Quote Reply
Re: Uploading and displaying images In reply to
Yay! It works! Smile

Thanks for the info about the upload success. I'll have to look into that.



------------------
JPD





Quote Reply
Re: Uploading and displaying images In reply to
I want to have several images in a record for display. I am not concerned with the upload mod at this time, I will upload the files manually. I am using Tim Ryan's templates and I have not been able to get an image to display.
I have followed pabloa's instructions. Question: is that the path to the file and not the URL? <I have tried both>. Do I need to add something to dbm_html_templates.pl?
Thank you
Quote Reply
Re: Uploading and displaying images In reply to
If the IMAGE field is in a field in your default.cfg file, then all you have to do is add the following tag in the html_record.html file:

Code:
<img src="<%Image%>">

Now...if it is a variable that you have defined...then you need to define the image variable in the sub html_record routine in the dbm_html_templates.pl file as tag, like the following:

Code:
Image => $image,

Then use the same tag as above.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Uploading and displaying images In reply to
This is from default.cfg:
'Photo page URL' => [21, 'alpha', 20, 255, 0, '', ''],

This is from html_record.html:
<img src="<%Photo page URL%>" BORDER=0 width="299" height="165" >

And this is what gets returned in a browser when doing a view or modify:
<img src="" BORDER=0 width="299" height="165" >

and still no image. DO you see an error?
thanks
Quote Reply
Re: Uploading and displaying images In reply to
Well, in your modify template files (html_record_form.html), you must include the following:

Code:
<img src="<%Photo page URL%>" value ="<%Photo page URL%>" BORDER=0 width="299" height="165" >

Hope this helps.

Regards,



------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: Uploading and displaying images In reply to
Yes! Thanks again.
Quote Reply
Re: Uploading and displaying images In reply to
You're welcome.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums