Displaying images in InfoPath 2007 browser forms served through Forms Services in SharePoint
Learn about workarounds that are available to display images in InfoPath forms that are served via InfoPath Forms Services in SharePoint.
The Picture control is not available in the list of controls when you create a browser-compatible form template (also see InfoPath 2007 features that are unavailable in InfoPath Forms Services), so you cannot use a Picture control to display images in an InfoPath form that is displayed in a browser via InfoPath Forms Services in SharePoint, but you still want to display images in an InfoPath browser form.
SolutionUse an Attachment control, a Rich Text Box control, or embed your form in a page that runs within SharePoint.
- Use an Attachment control if you have to store images within a form. However, this will not actually display the image on the form, but will only store the Base64 encoded string of the image in the form.
- Create a custom web page to display your form in, use ASP.NET controls to display images on the web page, and set up communication between the form and the web page to store the images within the form. In this case, the web page will display the images and *not* the InfoPath form. For more information on how to create a custom web page to display an InfoPath form, see Hosting the InfoPath 2007 Form Editing Environment in a Custom Web Form.
- Use a Rich Text Box control to display an image. While a Rich Text Box control cannot display embedded images when you use the control in browser forms served through InfoPath Forms Services in SharePoint, it can display linked images. The image must be published on a web server and accessible through an URL. You can then use an IMG element to add a link to the image to the Rich Text Box field. This will display the image in the Rich Text Box control in the browser form. For more information on how to do this, see How to display images in a repeating table in a browser form using a Rich Text Box control.
So the workarounds to displaying images on InfoPath browser forms are:
- If you only need to display images, you can go with option 3.
- If you need to display as well as store images, you can choose option 2.
- If you only need to store images, option 1 would suffice.
Copyright: This article may not be used on web sites (whether personal or otherwise), copied, disseminated, altered, printed, published, broadcasted, or reproduced in any way without an expressed written consent of S.Y.M. Wong-A-Ton. The techniques demonstrated in this article may be used within any Microsoft InfoPath project. This article is provided without any warranties. Copyright for this article is non-transferrable and remains with the author, S.Y.M. Wong-A-Ton.
Related InfoPath Articles:
- How to display images in a repeating table in an InfoPath browser form using a Rich Text Box control
- How to get HTML tags to appear as HTML and not as plain text in a Rich Text Box
- How to programmatically get or set the XHTML code of a Rich Text field in InfoPath 2007
- Change an image on an InfoPath form by selecting options
- Add a picture button with images in InfoPath 2010