Home > Domino Tips > Developer > Creating thumbnail images using LS2J in LotusScript
Domino Tips:
EMAIL THIS
 TIPS & NEWSLETTERS TOPICS 

LOTUSSCRIPT

Creating thumbnail images using LS2J in LotusScript


Jens Bruntt
06.29.2005
Rating: -4.84- (out of 5)


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


View member feedback to this tip.

This tip resolves a problem faced by many developers who code for the Web: how to create thumbnail images in Lotus Domino. Until I came up with this code, I either ended up with a solution that required manual steps or else I had to use an external program.

The code below uses LS2J to create thumbnail images in LotusScript. LotusScript does not natively have any methods for manipulating images, but Java does. LS2J (which is a part of Notes/Domino on the Win32 platform) makes it possible to expose Java functionality to LotusScript.

This tip employs an agent that is called in the WebQuerySave event of a Domino form. The agent, written in LotusScript, checks the document for image files, and if any are found, creates thumbnail files for them and attaches them to the document. You could create an agent for the Notes client that does the same thing. The central part of the agent is the line that calls the method that creates the thumbnail file. This method (thumbnailObject.ThumbnailThis in the code) receives four parameters:

I have a form that holds a Body-field and an upload control to allow Web users to attach image files. The form has the following in the WebQuerySave event: @Command([ToolsRunMacro]; "SaveWeb")

In the database I have an agent with the following code:

Below is the Java Library that makes it possible to create the thumbnail – when we make the


Digg This!    StumbleUpon Toolbar StumbleUpon    Bookmark with Delicious Del.icio.us   


RELATED CONTENT
Agent
Run or restart Notes/Domino agents via text messages
Approve Lotus Notes documents using a BlackBerry mobile device
LotusScript agent indexes Lotus Notes/Domino databases
Open documents in Lotus Notes from the Web without a UNID
Fix and update Lotus Notes documents with limited access
Verify scheduled agent status with Domino Extensible Language (DXL)
How to export data from a Lotus Notes database to a CSV file
Enable or disable scheduled agents without opening the Lotus Notes database design
Creating custom views in Lotus Notes databases
Editing fields in a Lotus Notes view with Ajax

Domino
Mimic Lotus Notes Domino application functionality on the Web
A single form to view and edit any Lotus Notes document
DECS and DCR external data access considerations
How to create non-scrolling Lotus Domino view headers on the Web
Disabling the 'Submit' button on a form
An easier way to update a rich text field
Results from Default Notes Search have # of responses in brackets
Lotus Notes/Domino veteran offers comprehensive list of app dev tools
Notes to XML. . .and back again
Fix for modified Form field value is ignored when document is submitted from the Web

LotusScript
LotusScript sorts lists alphabetically
LotusScript code rebuilds corrupted busytime.nsf file
Soft-code item names to facilitate LotusScript management
LotusScript agent automates selective mail file replication
LotusScript filters and attaches files to a Notes form
How to create mail files using a LotusScript agent
Extract value pairs from text arrays with LotusScript
Mass-input form uses LotusScript to ease large-scale employee moves
LotusScript button updates email addresses in Lotus Notes PAB
Code exports Lotus Notes data to an OpenOffice Calc spreadsheet

RELATED RESOURCES
2020software.com, trial software downloads for accounting software, ERP software, CRM software and business software systems
Search Bitpipe.com for the latest white papers and business webcasts
Whatis.com, the online computer dictionary


call for thumbnailObject.ThumbnailThis above.

You create a Java Library in the Designer in Shared code->Script Libraries, click New Java Library, and then remove the few lines of code that you get as a help for getting started, and paste the code below. Save and call the library "ThumbNail".

Jens Bruntt is a senior consultant at Convergens, a Danish company for whom he architects Domino-browser based Internet, intranet and extranet sites. He has been a developer and infrastructure advisor for Notes and Domino projects since 1994 and is an R6 Principal Developer. He is also SearchDomino.com's expert on Web development. Jens gives credit for this tip to Min-Chi Huang, who made sample thumbnailing code available to the openntf.org project, "Open Notes Picture Database."

MEMBER FEEDBACK TO THIS TIP

This is a very useful article. However, be careful about useing doc.save(...) in WebQuerySave-Agent. Nobody knows (not even IBM) what happens. Another problem is the use of "Toolkit.getDefaultToolkit().getImage(inputFilePath);" from the java.awt.* package -- it does not work on Unix/Linux maschines without startet X-Window Server.

—Matthias G.

Do you have comments on this tip? Let us know.

Please let others know how useful this tip is via the rating scale below. Do you have a useful Notes/Domino tip or code to share? Submit it to our monthly tip contest and you could win a prize and a spot in our Hall of Fame.

Rate this Tip
To rate tips, you must be a member of SearchDomino.com.
Register now to start rating these tips. Log in if you are already a member.


Submit a Tip




DISCLAIMER: Our Tips Exchange is a forum for you to share technical advice and expertise with your peers and to learn from other enterprise IT professionals. TechTarget provides the infrastructure to facilitate this sharing of information. However, we cannot guarantee the accuracy or validity of the material submitted. You agree that your use of the Ask The Expert services and your reliance on any questions, answers, information or other materials received through this Web site is at your own risk.



Domino & Lotus Notes Security Solutions: Authentication, Antispam, Encryption and Antivirus
HomeTopicsITKnowledge ExchangeTipsAsk the ExpertsMultimediaWhite PapersDomino IT Downloads
About Us  |  Contact Us  |  For Advertisers  |  For Business Partners  |  Site Index  |  RSS
SEARCH 
TechTarget provides technology professionals with the information they need to perform their jobs - from developing strategy, to making cost-effective purchase decisions and managing their organizations' technology projects - with its network of technology-specific websites, events and online magazines.

TechTarget Corporate Web Site  |  Media Kits  |  Site Map




All Rights Reserved, Copyright 1999 - 2009, TechTarget | Read our Privacy Policy
  TechTarget - The IT Media ROI Experts