NetTalk Central

Author Topic: How to keep the ratio of an image?  (Read 4783 times)

johanco123

  • Full Member
  • ***
  • Posts: 245
    • View Profile
    • Email
How to keep the ratio of an image?
« 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

terryd

  • Hero Member
  • *****
  • Posts: 759
    • View Profile
    • Davcomm
    • Email
Re: How to keep the ratio of an image?
« Reply #1 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
Terry Davidson
Windows 10 64 bit/Windows7 64bit
Clarion 9.1.11529/Clarion10 12567
Nettalk 913
Nettalk 1015
StringTheory267/Winevent515/XFiles298/MessageBox239/Cryptonite186

johanco123

  • Full Member
  • ***
  • Posts: 245
    • View Profile
    • Email
Re: How to keep the ratio of an image?
« Reply #2 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]

johanco123

  • Full Member
  • ***
  • Posts: 245
    • View Profile
    • Email
Re: How to keep the ratio of an image?
« Reply #3 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

Bruce

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 11250
    • View Profile
Re: How to keep the ratio of an image?
« Reply #4 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

johanco123

  • Full Member
  • ***
  • Posts: 245
    • View Profile
    • Email
Re: How to keep the ratio of an image?
« Reply #5 on: March 18, 2015, 05:04:02 AM »
Many tanks Bruce