This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Jan 5, 2012, 11:10 AM
51 Posts

creating thumbnail when uploading picture

  • Category: Other
  • Platform: Windows
  • Release: 8.5.3
  • Role: Developer
  • Tags:
  • Replies: 4
 I'm looking for a control that will save the uploaded picture in a richtext field and also a thumbnail of this picture.
I know this is one of the things Bildr does , but I don't know how to take out of this complex project only the part I need. 

Jan 6, 2012, 7:44 PM
51 Posts
Re: creating thumbnail when uploading picture
 I tried to implement it in my application with items from Bildr.
 
What I did : 
copied the custom controls: ccUploadConfig and ccUploadImages 
copied the Agent :(ImportPictures) 
copied the scripts :  xpageUploader and xpUploads
copied the resources files : plupload.flash.swf and plupload.full.mi.js and plupload.silverlight.xap 
Then I made a new xpage which loads the 2 custom controls just as in Bildr. In this xpage I also asigned some values to some session scoped variables. 
 
result: 
Xpage loads fine with ccUploadConfig 
 
when clicking next I get an error : 
 Script interpreter error, line=1, col=30: Unknown member 'join' in Java class 'java.lang.String'
 JavaScript code   1: sessionScope.imageExtensions.join(',')
I assigned a value to the sessionScope imageExtensions  "jpg,jpeg,jpe"
  
 
 
 
Jan 11, 2012, 10:58 AM
51 Posts
Re: creating thumbnail when uploading picture
 Sven,
I made an Agent as per your example. 
How do I call it from my Xpage ? 
and also How do I change c:\\test.bmp with the current saved file (unid and filename have been stored in a scoped variable , or isn't this the right way of dooing this?) 
 
Jan 11, 2012, 12:26 PM
272 Posts
Re: creating thumbnail when uploading picture
Hi,
 
you can start the agent in the postSave of your datasource.
 
<xp:this.data>
   <xp:dominoDocument var="editProfileDoc" ...>
      <xp:this.postSaveDocument><![CDATA[#{javascript:
         database.getAgent("picResizeAndClean").runWithDocumentContext(editProfileDoc.getDocument());}]]>
      </xp:this.postSaveDocument>
   </xp:dominoDocument>
</xp:this.data>
 
Alternativly you can start it in an action or whatever you want.
 
The picture to transform can accessed by using this:
 
   // get the uploaded file
   curDoc.getAttachment(curDoc.getItemValueString("fd_PictureName")).extractFile(tempDir);
 
where "tempDir" is a path for the picture to extract, and "fd_PictureName" the field name where the picture is stored.
 
Sven
 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal