AnsweredAssumed Answered

How to set width and height of an image

Question asked by pavelvpv on Jun 27, 2016
Latest reply on Jun 28, 2016 by ppapadopoulosmarathondata-gr-esridist


Hi,

 

I'm trying to add an image to the map using Javascript API 3.16. But I can't apply width and height to the image.

When I'm adding the image, style attribute of the image is set to width, height of map style. So the image is stretched.

 

Here is the piece of code I'm using:

    require(["esri/layers/MapImageLayer",

            "esri/layers/MapImage"],

            function(MapImageLayer, MapImage) {

                var newImage = MapImage({

                            'extent': self.map.extent.toJson(),

                            'href': url

                        });

 

                newImage.width = width;

                newImage.height = height;

 

                var imageLayer = new MapImageLayer({

                                id: layer_id

                            });

                imageLayer.addImage(newImage);

                self.map.addLayer(imageLayer);

}

Outcomes