86beast
10-08-2008, 06:34 PM
I am stumped here, any ideas?
Ok I need a script that will display an image located on a network location (\\server1\share1\employee\employee1.jpg) according to what text is entered into a certain text field.
So for example:
user1 enters a asp based helpdesk. Submits a ticket. The tech gets it and see's the text field named email with the users email address entered. Next to the users name would be a small picture of the user that submitted the request.
Is this possible? I have complete control of image placement and IIS. I run the server. The script can be in ASP/HTML/VB/Java etc..
At this point I am frustrated and could just use a small bit of code to show me how it's done... :banghead
tyman00
10-08-2008, 06:50 PM
I would save all of your employee photos as emailAlias.jpg say the user had an email address of jdoe@domain.com. Save the photo as jdoe.jpg.
Then use ASP to strip all of the characters in the email address from the @ back. Then use the result of having everything stripped in your call for the image. I don't know ASP syntax and I am too lazy to research it but it would be something like:
alias = StripRight ("emailAddress","@");
print "<img src='\\server1\share1\employee\" . alias . ".jpg' alt='Employee Photo' />"
Again I don't know ASP, but that is the logic I would use. Let me know if it doesn't make sense.
Edit: Also, unless your support team is using all Microsoft products (IE, Outlook) the whole \\server1\share1\ may not work. You might want to setup a host header and have http://photos.yourLocalDomain.com point to \\server1\share1\employee so you can call the image tag this way <img src="http://photos.yourLocalDomain.com/jdoe.jpg" alt="Employee Photo" />
MajSuckelton
10-09-2008, 10:16 AM
Maybe I don't understand the question completely, but:
<% employeeImage = request.form("txtImage") %>
<img src="\server1\share1\employee\<%=employeeImage%>.jpg">
Feel free to clarify if this doesn't answer your question. I do asp all day long.
tyman00
10-09-2008, 11:42 AM
Maybe I don't understand the question completely, but:
<% employeeImage = request.form("txtImage") %>
<img src="\server1\share1\employee\<%=employeeImage%>.jpg">
Feel free to clarify if this doesn't answer your question. I do asp all day long.
There that looks better than mine. I would get the information from the email alias. That is the one constant you have to work with. The below code should work. It does assume though that everyone has the same domain in their email address. Make sure you change the number in emailAliasLen (11 in this example) to the length of your domain including the AT symbol.
<%
emailAddress = request.form("emailAddress")
emailAddressLen = Len(emailAddress)
emailAliasLen = emailAddressLen - 11 '11 is the length of your domain including the at symbol ---> @domain.com
alias = Mid(emailAddress, 1, emailAliasLen)
%>
<img src="<img src="\server1\share1\employee\<%=alias%>.jpg" alt="Employee Photo" />
MajSuckelton
10-09-2008, 11:59 AM
You would just do a
left(emailAddress, instr(emailAddress, "@")-1)
to get the alias from the email address.
86beast
10-09-2008, 12:57 PM
Ok I understand what your saying but I don't understand how to make it work with the code snippet below. That is the asp code in red for the users email which is just dispalyed in a text box.
<td>
<b><%=lang(cnnDB, "EMail")%>:</b>
</td>
<td>
<input type="text" name="uemail" size="20" value="<% = uemail %>" <% = strTextDisable %>><em>*</em> </td>
I have tryed this:
<% EnteredBy = request.form("uemail") %>
<img src="\\server1\share1\employee\<%=employeeImage%>.jpg">
While the the page does not have a problem running with the code in bold It only shows :red x where image should be. I have to be missing something here, but what?
The other option which may be easier is a place where the user name is shown. Example of output:
Entered By: JThomas
<td>
<b><%=lang(cnnDB, "EnteredBy")%>:</b>
</td>
<td>
<% = Usr(cnnDb, entered_by, "uid") %>
</td>
MajSuckelton
10-09-2008, 01:36 PM
Most likely you need to put the folder with the images in the same folder on the server that the web page is in for simplicity sake. If the page you are seving is http://www.website.com/webapp/email.asp and you put a folder called employee in the webapp directory then your src would look like "/employee/<%=employeeImage%>.asp". You don't have to specefy the entire url. If you want to back up a folder you use "../employee/<%=employeeImage%>.asp".
86beast
10-09-2008, 01:57 PM
Ok so if I am following you correctly:
<% EnteredBy = request.form("uemail") %>
<img src="http://Helpdesk/User/EmpImg/<%=uemail%>.jpg">
MajSuckelton
10-09-2008, 02:02 PM
Ok so if I am following you correctly:
<% EnteredBy = request.form("uemail") %>
<img src="http://Helpdesk/User/EmpImg/<%=EnteredBy%>.jpg">
With the above change, it should work, though I'm saying that if the folder with the images is in the same directory as your web then you don't have to fully qualify the url. You can navigate to it from the page you are in. What is the URL of the page and what is the url of the images?
86beast
10-09-2008, 02:06 PM
Url of helpdesk: http://support/helpdesk
Url of images: http://support/helpdesk/reps/empimg
Oh :doh0715: "../empimgs
MajSuckelton
10-09-2008, 02:08 PM
src="/reps/empimg/<%=EnteredBy%>.jpg"
86beast
10-09-2008, 02:27 PM
Yahoooooo!!!!! :rockon :beer :beer Thanks bud :) God I feel like a ton has been lifted. Man you deserve another :beer