Solved! Go to Solution.
<!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>demo</title> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/css/esri.css"> <link rel="stylesheet" href='http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/dijit/css/Popup.css'/> <style> html, body { height: 100%; width: 100%; margin: 0; padding: 0; } #map { position: absolute; top:0; bottom:0; left:0; right:0; } </style> </head> <body class="claro"> <div id="map"></div> </body> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/"></script> <script src="main.js"></script> </html>
/* * Add attachment images through this sample: http://help.arcgis.com/en/webapi/javascript/arcgis/samples/ed_attachments/index.html * And use this demo to view them in a popup */ (function() { // dojo config stuff require({ parseOnLoad:true }); require([ 'dojo/dom-construct', 'dojo/_base/connect', 'esri/dijit/Popup', 'esri/layers/FeatureLayer', 'dojo/domReady!' ], function (domConstruct, connect) { var map, popup, featureLayer; popup = new esri.dijit.Popup(null, domConstruct.create('div')); map = new esri.Map('map', { basemap: 'streets', center: [-122.427, 37.769], zoom: 19, infoWindow: popup }); connect.connect(map, 'onLoad', function (_map_) { featureLayer = new esri.layers.FeatureLayer('http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0', { mode: esri.layers.FeatureLayer.MODE_ONDEMAND }); connect.connect(featureLayer, 'onClick', function (e) { var objectId, el; objectId = e.graphic.attributes[featureLayer.objectIdField]; featureLayer.queryAttachmentInfos(objectId, function (infos) { map.infoWindow.setTitle(objectId); el = document.createElement('img'); if (!!infos[0].url) { el.setAttribute('src', infos[0].url); map.infoWindow.setContent(el); map.infoWindow.show(e.screenPoint, map.getInfoWindowAnchor(e.screenPoint)); } }); }); map.addLayer(featureLayer); }); }); }).call(this);
Dear Craig,
How can i do the same example using Arcgis Api for siverlight shown in this link http://www.arcgis.com/home/webmap/viewer.html?webmap=5b9675ca7ca9426a99ced88f66b42331
FeatureLayerInfo queryFeatLayerInfo = queryFeatLayer.LayerInfo; try { if (queryFeatLayerInfo.HasAttachments) { queryFeatLayer.QueryAttachmentInfos(featureGraphic, FeatureLayer_QryAttachmentsComplete, FeatureLayer_QryAttachmentsFail); } } catch (Exception ex) { Debug.WriteLine(ex.ToString()); }
var attachmentInfos = aInfos as IList<AttachmentInfo> if (attachmentInfos.Any()) { image.url = attachmentInfos.First().Uri.ToString() }
Hi--question : How did you have to configure the Output folder? And why? Thanks
<!doctype html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <title>demo</title> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/dojo/dijit/themes/claro/claro.css"> <link rel="stylesheet" href="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/css/esri.css"> <link rel="stylesheet" href='http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/js/esri/dijit/css/Popup.css'/> <style> html, body { height: 100%; width: 100%; margin: 0; padding: 0; } #map { position: absolute; top:0; bottom:0; left:0; right:0; } </style> </head> <body class="claro"> <div id="map"></div> </body> <script src="http://serverapi.arcgisonline.com/jsapi/arcgis/3.3/"></script> <script src="main.js"></script> </html>
/* * Add attachment images through this sample: http://help.arcgis.com/en/webapi/javascript/arcgis/samples/ed_attachments/index.html * And use this demo to view them in a popup */ (function() { // dojo config stuff require({ parseOnLoad:true }); require([ 'dojo/dom-construct', 'dojo/_base/connect', 'esri/dijit/Popup', 'esri/layers/FeatureLayer', 'dojo/domReady!' ], function (domConstruct, connect) { var map, popup, featureLayer; popup = new esri.dijit.Popup(null, domConstruct.create('div')); map = new esri.Map('map', { basemap: 'streets', center: [-122.427, 37.769], zoom: 19, infoWindow: popup }); connect.connect(map, 'onLoad', function (_map_) { featureLayer = new esri.layers.FeatureLayer('http://sampleserver3.arcgisonline.com/ArcGIS/rest/services/SanFrancisco/311Incidents/FeatureServer/0', { mode: esri.layers.FeatureLayer.MODE_ONDEMAND }); connect.connect(featureLayer, 'onClick', function (e) { var objectId, el; objectId = e.graphic.attributes[featureLayer.objectIdField]; featureLayer.queryAttachmentInfos(objectId, function (infos) { map.infoWindow.setTitle(objectId); el = document.createElement('img'); if (!!infos[0].url) { el.setAttribute('src', infos[0].url); map.infoWindow.setContent(el); map.infoWindow.show(e.screenPoint, map.getInfoWindowAnchor(e.screenPoint)); } }); }); map.addLayer(featureLayer); }); }); }).call(this);