Click to See Complete Forum and Search --> : How to display images?
ss_learner
09-08-2005, 10:30 PM
Hi
Can anyone help me out.
I have an asp page in which I have a dropdown list of students.
And when ever I select a name from the dropdown list, I should show their photo beside the dropdownlist on the asp page
All the photos are at present in a folder.
Do I need a part of url to be placed inthe table to retrieve the photos or
can I display it direct from the folder itself. If so, could you pls tell me howto do it (ofcourse a bit of code wil help me :)
Pls help me out!!
Thanks very much in advance
Regards
jjr0319
09-08-2005, 10:59 PM
i dont know if this is the best way, but i would just use a HTML form with an iframe. below is the code, and i even uploaded the sample so you can see what it looks like: http://www.lasalle.edu/~rotondj1/picswap/
<FORM name="form">
<SELECT name="pictures" onChange="parent.student.location=document.form.pictures.options[document.form.pictures.selectedIndex].value">
<OPTION SELECTED value="">--Choose--
<OPTION value="folder/student1.jpg">Student 1
<OPTION value="folder/student2.jpg">Student 2
<OPTION value="folder/student3.jpg">Student 3
</SELECT>
</FORM>
<iframe src="" frameborder="0" name="student" height="300" width="250" scrolling="no"></iframe>
i just threw this together real quick. sorry if it's crap, and not what you're looking for.
ss_learner
09-08-2005, 11:19 PM
Hi
Thanks very much for your help..
I run the sample and looks fine..
But here I guess i have a bit of problem..
The number of students in the table might be increasing and i cannot hardcode also, I just realized the problem that the name of the student and the name in the folder against their picture is not the same for eg
if the student name is "student name test"
then his image can have a name "student_test.pg"
is there anyother way out other than using database url part
(if not, then I keep on adding the url part into the table for about 1000 students :( at present)
jjr0319
09-09-2005, 09:47 AM
if you named the pictures in some type of numerical order, then you wouldn't have to populate the database with the URLs. for example, you could use the code i made, but instead put some type of loop so that for each record, the picture number increases by 1. so you would name the pictures something like student1.jpg, student2.jpg, etc... and call a loop that would start with student1.jpg and continue adding a "1" after the word student until all the pictures are accounted for. im not exactly sure how to code this, as im pretty new to ASP.
<FORM name="form">
<SELECT name="pictures" onChange="parent.student.location=document.form.pictures.options[document.form.pictures.selectedIndex].value">
<OPTION SELECTED value="">--Choose--
LOOP GOES HERE
<OPTION value="studentN.jpg"> SOMETHING GOES HERE THAT WOULD ADD "1" TO THE END OF THE PICTURE NAME FOR EACH RECORD"><% student_name %>
</SELECT>
</FORM>
sorry i cant be of more help.
jPaulB
10-03-2005, 08:18 PM
How should that code appear when the path to the image file is a known value, drawn from a text-field in the database table?
For example: value= RsRecordSet("location")
// RsRecordSet = "../data/image1.jpg"
Thanks
-Paul-