This tutorial shows how to create a blank ASP.NET MVC 4 application in Visual Studio .NET 2013 and add the web image viewer and web thumbnail viewer to a page of ASP.NET MVC application.
Here are steps, which must be done:
public MyVintasoftImageApiController() : base() { IsEmptySessionSupported = true; }
<appSettings> <add key="VintasoftWebImaging_UploadDirectoryName" value="UploadedImageFiles"/> <add key="VintasoftWebImaging_ResourceDirectoryName" value="Resources"/> <add key="VintasoftWebImaging_CacheDirectoryName" value="VintasoftCache"/> <add key="VintasoftWebImaging_CachedThumbnailsDirectoryName" value="Thumbnails"/> <add key="VintasoftWebImaging_CachedImageTilesDirectoryName" value="Tiles"/> <add key="VintasoftWebImaging_CacheLifeTime" value="10080"/> </appSettings>
<script type="text/javascript" src="jquery-1.11.0.js"></script> <script type="text/javascript" src="Vintasoft.Shared.js"></script> <script type="text/javascript" src="Vintasoft.Imaging.Html5.js"></script>
<div id="WebThumbnailViewer1Div" style="width: 240px; height: 650px; float:left"/> <div id="WebImageViewer1Div" style="width: 650px; height: 650px; float:left"/>
<script type="text/javascript"> Vintasoft.Shared.WebImagingEnviromentJS.set_SessionId("SessionId"); </script>
<script type="text/javascript"> Vintasoft.Shared.WebServiceJS.defaultImageService = new Vintasoft.Shared.WebServiceControllerJS("api/MyVintasoftImageApi"); Vintasoft.Shared.WebServiceJS.defaultImageCollectionService = new Vintasoft.Shared.WebServiceControllerJS("api/MyVintasoftImageCollectionApi"); </script>
<script type="text/javascript"> var webThumbnailViewer1 = new Vintasoft.Imaging.Html5.WebThumbnailViewerJS("WebThumbnailViewer1Div"); var webImageViewer1 = new Vintasoft.Imaging.Html5.WebImageViewerJS("WebImageViewer1Div"); </script>
<script type="text/javascript"> webImageViewer1.set_MasterViewer(webThumbnailViewer1); </script>
<script type="text/javascript"> // load file "UploadedImageFiles/AllSupportedBarcodes.png" into viewer // ("UploadedImageFiles" directory can be changed using the VintasoftWebImaging_UploadDirectoryName key in Web.config file) webImageViewer1.get_Images().openFile("AllSupportedBarcodes.png"); </script>
<script type="text/javascript"> // specify the default web service, which should be used for managing of files Vintasoft.Shared.WebServiceJS.defaultFileService = new Vintasoft.Shared.WebServiceControllerJS("api/MyVintasoftFileApi"); // Request for copying file is executed successfully. function copyFile_success(answer) { // open file copy. webImageViewer1.get_Images().openFile(answer.fileId); } // Request for copying file is failed. function copyFile_error(answer) { // catch error } Vintasoft.Imaging.VintasoftFileAPI.copyFile("UploadedImageFiles/AllSupportedBarcodes.png", copyFile_success, copyFile_error); </script>