It confused the heck out of me at first, this is a tricky thing.
In Fact it occurred to me, as I was finishing the below explanation, that this may not work for you.
I depends on how and where you are using the images.
I use the following code to display an image on a record view. I have people and equipment. If I was to go to my record I would see a small picture of me, next to my record details. (name, age, attractiveness scale) Similar to how the card view displays
The important thing is the image is not a static image, it is a different image/images for every record.
This would be awesome, if you had multiple pictures for a record, could be mug shots. Front/side/back in a slide show. Shopping cart, etc.
BUT.. If you are using static images in your slideshow and the reason you want them as a record attachment is to make them easier to update? IT NOT GOING TO WORK AS EXPECTED.
Why? Because every-time you upload an image the attachment ID changes, you would have to re-code your slide every time you changed images, it would be much easier to use resource section.
I am going to explain the code I sent you below for two reasons.
1. I sent the code and others may see it and be confused.
2. More importantly I wrote the whole thing already. Then realized it likely will not help you.
HERE WE GO..
This is for displaying an image attachment in a record Xhtml column.
Use the documentation to "suppliment" what I type here
https://www.teamdesk.net/help/13.3.aspxgo to the section near the bottom "User/Session Specific Functions"
I will break down the code really quick
(AT SECOND GLANCE I SEE I OVERLY COMPLICATED THE CODE I SENT, sorry, I will still explain the whole thing for anyone reading
This code needs to go into one of the places that accepts HTML.
We start with an image tag
The very basic of an image tag is.
<img src="path to image"> </i> or the self closing format
<img src="path to image" />
Make an HTML column and place this line of code into it
<img src="http://www.waterswebworks.com/bird.jpg" />
When you view the table records the new column should have a picture of a bird, that I place on a web server.
(You can place your images on a web server folder and connect to them with the above code)
I add the style="width:100%" to control the image size. Basic CSS.
NOW comes the complicated part.
We want to embed a picture from a record attachment, This is actually fairly complicated. It took quite a bit of trial and error, and help to get this correct.
We need to replace the src with the record path to do this we need to get out of HTML and into TEAMDESK mode, we do that by using the special tag <%= "teamdesk code" %>
Like this <img src=" <%= "teamdesk code" %> " />
TIP.. I always reformat this command to make it easier to understand
I start with. <img src=" " />
I then toss some line returns in
<img src="
" />
Now I know that the Teamdesk code I then add the <%= tag
<img src="
<%=
%>
" />
I save at this point, if I am able to save, I know I have the basic command correct, then I can concentrate on the teamdesk code.
We need to concatenate multiple commands/sections to get the correct path. To get this path do this.
View one of the records that has an image in it. Now right click on the image and view in new tab. Now copy the URL and paste it into a text editor for reference.
This is an example from one of my database. I AM CHANGING THE FID-ID SO IT WILL NOT LINK. But it is the exact code we need
https://www.teamdesk.net/secure/db/42540/attachment.aspx?fid=6959&guid=6292A633-FA69-4A44-AC2A-68FEB665E93F&ext=.jpgNOTE, since I am inside the <%=%>, I need to surround the URL with "" so it becomes text..
<img src="
<%=
"
https://www.teamdesk.net/secure/db/42540/attachment.aspx?fid=6959318&guid=6292A633-FA69-4A44-AC2A-68FEB665E93F&ext=.jpg"
%>
" />
The above code will display the image.
NOTE if you upload a new image it will change the guid portion, and it will no longer work.
Since I want the image from the record itself, I build the src= "" from the record information. I concantenate the parts together
https://www.teamdesk.net/secure/db/42540 comes from the command URLROOT()
"/attachment.aspx?fid=6959318&guid=" This is manually added text. fid is form ID and we get it manually from the URL
6292A633-FA69-4A44-AC2A-68FEB665E93F comes from command Right([Employee Picture],";"). The [] is a file column set to no revisions. If you have revisions, this will not work..
&ext=.jpg" this final bit we add as text. This limits us to .jpg images only. You can replace it with .png, so long as all the images are then .png. (it is possible to account for mixed file types, but its damned complicated)
We concatenate all the pieces together using &
NOW finally, I wrapped the URL in an IF statement. The idea was to display the words "no pic" if there was no attachment in the record. It does not actually work correctly as I entered it. What needs to be done is a blank placeholder image should be saved to the resources section, then replace "no pic" with the path to the placeholder image.
This is something I was supposed to do but forgot, and just realized its not finished.
the final code should look something like this
<img style="width:100%;" src="
<%
If(IsNull([Employee Picture]),
URLRoot()& "/res.aspx/blank.jpg",
URLRoot()&"/attachment.aspx?fid=6959318&guid="&Right([Employee Picture],";")&"&ext=.jpg"
)
%>
"/>
Hope this helps.
cooper
waterswebworks