NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: johanco123 on March 12, 2015, 01:30:35 AM

Title: How to keep the ratio of an image?
Post by: johanco123 on March 12, 2015, 01:30:35 AM
Hi Bruce

I am using a image control on a form. I want to set the Image Height to '250' and leave the Image Width blank or ''. How can i keep the aspect ratio of the image to display the correct width.

Nettalk8.35

Kind regards
Johan
Title: Re: How to keep the ratio of an image?
Post by: terryd on March 12, 2015, 04:43:07 AM
Hi Johan That should do it. Normally if you nominate height or width and leave the other blank the aspect ratio will stay the same
Title: Re: How to keep the ratio of an image?
Post by: johanco123 on March 13, 2015, 12:36:22 AM
Hi Bruce
Please find attach an example of the image aspect ratio problem.

Tanks Terry. That is what I used to do with to display the images in ratio, but I cannot get it to display correctly.

Nettalk8.35

Regards
Johan

[attachment deleted by admin]
Title: Re: How to keep the ratio of an image?
Post by: johanco123 on March 16, 2015, 09:57:45 PM
Hi Bruce

Any suggestions how to get the aspect ratio sorted out on an image control. It is the same with the display control.

Regards
Johan
Title: Re: How to keep the ratio of an image?
Post by: Bruce on March 18, 2015, 04:03:43 AM
hi Johan,

there's a bit of code doing that in the netweb.clw in the CreateImage method;

  if loc:height and not loc:width then loc:width = loc:height.   
  if loc:width and not loc:height then loc:height = loc:width.

you can comment out this code - I don't think it's needed. I've commented it out for the 8.42 build.

cheers
Bruce
Title: Re: How to keep the ratio of an image?
Post by: johanco123 on March 18, 2015, 05:04:02 AM
Many tanks Bruce