OpenNTF.org - Simulating attachments as thum
My Links (Not logged in)
Code Bin Search
 
Hosted by Prominic.NET
Rate This Code
5 - brilliant stuff
4 - very nice
3 - average
2 - needs work
1 - bad
   OpenNTF Code Bin
About This Code
Brief Description:
Simulating attachments as thumbnails 
Rating:
Rating: 4 , Number of votes: 1 
Contributor:
Parthasarathy Perumbali 
Category:
Lotus Formula 
Type:
Webdevelopment 
Notes Version:
R5.x 
Last Modified:
30 Dec 2003 
OpenNTF Disclaimer

All of the program code and information presented in the OpenNTF.org Code Bin are provided "as-is", and should be used at your own risk. OpenNTF.org make no express or implied warranty about anything in the Code Bin, and OpenNTF.org will not be responsible or liable for any damage caused by the use or misuse of anything from this site. OpenNTF.org makes no guarantees about anything. Please thoroughly test all of the knowledge and code you find here before you attempt to use them in your production environment.

Code / Description

I took Dovid's solution from the forum and customized it...

This will work for Gif,jpg,jpeg

It can be easily added for other image formats


Just create computed text and paste this formula


db := @ReplaceSubstring(@Subset(@DbName;-1);"\\";"/");
thumbWidth := "400 ";
thumbHeight := "150";
GIFs := @If ((@Contains(@UpperCase(@AttachmentNames); ".GIF")) ;@Trim(@Left(@UpperCase(@AttachmentNames); ".GIF")); "");
JPGs := @If ((@Contains(@UpperCase(@AttachmentNames); ".JPG")) ;@Trim(@Left(@UpperCase(@AttachmentNames); ".JPG")); "");
JPEGs := @If ((@Contains(@UpperCase(@AttachmentNames); ".JPEG")) ;@Trim(@Left(@UpperCase(@AttachmentNames); ".JPEG")); "");

NewGIFs:=@If (GIFs="";"";GIFs+".GIF");
NewJPGs:=@If (JPGs="";"";JPGs+".JPG");
NewJPEGs:=@If (JPEGs="";"";JPEGs+".JPG");
files := @Trim(NewGIFs : NewJPGs :NewJPEGs);
urls := "\"/" + db + "/" + @Text(@DocumentUniqueID) + "/$File/" + @Text(files) + "\"";
urlnew:= @ReplaceSubstring(urls;" ";"%20");
@If(@Elements(files);"<A onclick= javascript:window.open("+urlnew +") TARGET=_new><img src=" + urls + "\" +\" border=0 width=" + thumbWidth + " height=" + thumbHeight + "></A><br><a class=\'BodyText\' onclick=return false style=\'text-decoration:none\'>Click on the image to preview the full image</a>";"")

Usage / Example
 Comments
Posted by Robert Griego on 06/23/2004 09:57:38 AMNotes?
This works great on the web, but not in notes. Or did I do something wrong? I added this code to a computed text field and set it to Pass thru HTML. I also set "Force pass thru HTML in Notes". Still all I get is a red x....
Posted by Phani Kumar on 07/02/2004 05:26:06 AMNotes?
Robert, the only reason why you are getting to look that red x is because it is not finding the location of the image. The reason behind that is, the notes client cannot navigate to the specified value in the url. Only the web server can understand what is "/" in the beginning.
"/" - gets the whole info of the server like for ex: http://servername/... etc.
So, client cannot get this value. So inorder to achive this simply write the database path or formula to open the specified image.
And more over pass through is designed to work with web browsers. So, try going in client way......:)
HTH,
Kiran....
 Add your comment!