NetTalk Central

Author Topic: Photo size  (Read 3844 times)

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Photo size
« on: June 20, 2010, 01:23:28 PM »
Hi,
In order to show a photograph in the right size ratio, I am looking for a way to find out the width and height of any image I want to show on a page.
Has anyone experience in this field??

Rene
Rene Simons
NT14.14

bshields

  • Sr. Member
  • ****
  • Posts: 392
    • View Profile
    • Inhabit
    • Email
Re: Photo size
« Reply #1 on: June 20, 2010, 06:54:41 PM »
Hi Rene,

If you just set the width only or height only, although its not official in the HTML spec, browsers will ensure the aspect ratio is maintained.

Other than that we use either ImageEx or Leadtools to check on the size of images for other stuff.

Regards
Bill

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Photo size
« Reply #2 on: June 21, 2010, 12:18:28 AM »
Hi Bill,

Thanks for your reply.
That really is a nice browser feature. However (here it comes).....
I have differently orientated photos, i.e. landscape and portrait.
I want them all to look "the same" so I need to do a bit of calculation I think.
In Clarion windows applications there is something like ?img{prop:width} but not in NTWS.
Hence my question.

Thanks,
Rene
Rene Simons
NT14.14

Alberto

  • Hero Member
  • *****
  • Posts: 1873
    • MSN Messenger - alberto-michelis@hotmail.com
    • View Profile
    • ARMi software solutions
    • Email
Re: Photo size
« Reply #3 on: June 21, 2010, 05:02:35 AM »
Rene,
Make a normal Windows proc ( (string),real ), pass it the image and use the following code (after open the window) to obtain the ratio:

  0{prop:hide}=true
  if exists(pFile) and inlist(right(clip(pFile),3),'jpg','bmp','gif')>0
     ?Image{Prop:NoWidth} = true
     ?Image{Prop:NoHeight} = true
     ?Image{prop:text}=pFile
     Ancho$ = ?Image{Prop:Width}
     Alto$  = ?Image{Prop:Height}
     ?Image{Prop:Width}      = 50
     ?Image{Prop:Height}     = 50 * Alto$ / Ancho$
     If ?Image{Prop:Height}  > 50
         ?Image{Prop:Height} = 50
         ?Image{Prop:Width}  = 50 * Ancho$ / Alto$
     End
     loc:Ratio=Alto$ / Ancho$
  else
     loc:ratio=1
  end
  post(event:closewindow)

Hope this helps
Alberto
-----------
Regards
Alberto

Rene Simons

  • Hero Member
  • *****
  • Posts: 650
    • View Profile
Re: Photo size
« Reply #4 on: June 21, 2010, 01:15:07 PM »
Hi Alberto,
Very nice.
Thank you
Rene
Rene Simons
NT14.14