NetTalk Central

NetTalk Web Server => Web Server - Ask For Help => Topic started by: Rene Simons on June 20, 2010, 01:23:28 PM

Title: Photo size
Post by: Rene Simons 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
Title: Re: Photo size
Post by: bshields 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
Title: Re: Photo size
Post by: Rene Simons 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
Title: Re: Photo size
Post by: Alberto 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
Title: Re: Photo size
Post by: Rene Simons on June 21, 2010, 01:15:07 PM
Hi Alberto,
Very nice.
Thank you
Rene