Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image getting stretched in Image layer #1533

Open
Shubham-Tops opened this issue Apr 10, 2020 · 0 comments
Open

Image getting stretched in Image layer #1533

Shubham-Tops opened this issue Apr 10, 2020 · 0 comments

Comments

@Shubham-Tops
Copy link

HI,

I am not sure is this a bug or not, but I am facing an image get stretched issue. Might I am missing something. Below is my code for clear understanding.

   var img_src = "dynamic image url";
   map = new OpenLayers.Map('map', { numZoomLevels: 4 });
  
  var proof = new OpenLayers.Layer.Image(
                    'proofimg', 
                    img_src, 
                    new OpenLayers.Bounds(-375, -750, 375, 750), 
                    new OpenLayers.Size(375, 750)
                  );

    proof.setIsBaseLayer(true);

    proof.display(true);

    map.addLayer(proof);

    map.setCenter(new OpenLayers.LonLat(0,0),0,false,true);

Note : I am not allowed to change image dimensions at any cost. Image can be of any height width and this img_src will be dynamic(it will be uploaded by end user), coming straight from database. Any new way of initialization is welcomed. I mean using any property of ol2

I need a way where this height, width could be set automatically.

Below is the line where I think something could be done.
var proof = new OpenLayers.Layer.Image(
'proofimg',
img_src,
new OpenLayers.Bounds(-375, -750, 375, 750),
new OpenLayers.Size(375, 750)
);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant