This is GREAT!  Thanks a ton.  This works perfectly.

You made my boss happy (and me, too!). :P

---Michael


--- Roji Thomas <[EMAIL PROTECTED]> wrote:
> Here is the script for getting image size.
> I got it soewhere from the web, not sure abt
> the source, but it works.
> Sorry to the original programmer.
> 
> Sub GetPicFileInfo( i_sFilename, o_PicType,
> o_nWidth, o_nHeight )
>       o_PicType = ""
>       o_nWidth = 0
>       o_nHeight = 0
> 
>       Dim fso, ts
>       Dim GIF_MARKER, JPG_MARKER
> 
>       GIF_MARKER = "GIF8"
>       JPG_MARKER = Chr(&HFF) & Chr(&HD8) & Chr(&HFF)
> & Chr(&HE0)
> 
>       Set fso =
> CreateObject("Scripting.FileSystemObject")
>       Set ts = fso.OpenTextFile(i_sFilename)
> 
>       On Error Resume Next
>       Select Case ts.Read(4)
>           Case GIF_MARKER
>               o_PicType = "GIF"
>               ts.Skip(2)
>               If Err.Number <> 0 Then
>                   Exit Sub
>               End If
>               o_nWidth = Asc(ts.Read(1)) + (
> Asc(ts.Read(1))* 256 )
>               o_nHeight = Asc(ts.Read(1)) + (
> Asc(ts.Read(1))* 256 )
> 
>           Case JPG_MARKER
>               o_PicType = "JPG"
> 
>               Dim byteVal, bDone
>               bDone = False
>               byteVal = Asc(ts.Read(1))
>               Do While Not ts.AtEndOfStream And
> byteVal <> &HD8 And Not
> bDone
>                   'look for the next marker (xFF)
>                   Do While Not ts.AtEndOfStream And
> byteVal <> &HFF
>                       byteVal = Asc(ts.Read(1))
>                   Loop
> 
>                   'Get past any repeated xFF markers
>                   Do While Not ts.AtEndOfStream And
> byteVal = &HFF
>                       byteVal = Asc(ts.Read(1))
>                   Loop
> 
>                   'Check out the marker
>                   'if this is the width/height
> section then read the values
>                   If ((byteVal >= &HC0) And (byteVal
> <= &HC3)) Then
>                       ts.Skip(3)
>                       If Err.Number <> 0 Then
>                           Exit Sub
>                       End If
>                       If Not ts.EOF Then
>                           o_nWidth =
> (Asc(ts.Read(1)) * 256) +
> Asc(ts.Read(1))
>                           o_nHeight =
> (Asc(ts.Read(1))* 256) +
> Asc(ts.Read(1))
>                           bDone = True
>                       End If
>                   Else
>                     'this is a comment or other
> stuff we are not interested
> in.
>                     'we must read the size and then
> skip over this section
>                     Dim nSectionLength
>                     nSectionLength =
> (Asc(ts.Read(1)) * 256) +
> Asc(ts.Read(1))
> 
>                     'NOTE: we subtract two since
> from the size since we
> already
>                     'are past the length bytes which
> are included in the
> size
>                     ts.Skip(nSectionLength - 2)
>                     byteVal = Asc(ts.Read(1))
> 
>                     If Err.Number <> 0 Then
>                         Exit Sub
>                     End If
>                 End If
>             Loop
>       End Select
> 
>       Set ts = Nothing
>       Set fso = Nothing
>   End Sub
> 
> 
> ----- Original Message -----
> From: "Michael Gardner" <[EMAIL PROTECTED]>
> To: "ActiveServerPages"
> <[EMAIL PROTECTED]>
> Sent: Saturday, October 12, 2002 10:42 PM
> Subject: Slightly OT: Getting Width and Height of an
> image
> 
> 
> > I have a third-party com object that creates an
> image.
> >  The size varies on the information in the image. 
> Is
> > there a way to get the height and width of image
> > programatically so that can create an image of the
> > same size of my own to display on the same page?
> >
> > I have not be able to find much about this either
> on
> > MSDN or google.  Any help would be most
> appreciated.
> >
> >
> > TIA
> >
> > ---Michael
> >
> >
> > __________________________________________________
> > Do you Yahoo!?
> > New DSL Internet Access from SBC & Yahoo!
> > http://sbc.yahoo.com
> >
> > ---
> > You are currently subscribed to activeserverpages
> as:
> [EMAIL PROTECTED]
> > To unsubscribe send a blank email to
> %%email.unsub%%
> >
> 
> ---
> You are currently subscribed to activeserverpages
> as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
%%email.unsub%%


__________________________________________________
Do you Yahoo!?
New DSL Internet Access from SBC & Yahoo!
http://sbc.yahoo.com

---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to