Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

image width, height and size

Posted on 2002-07-02
3
Medium Priority
?
325 Views
Last Modified: 2006-11-17
Hi,

How to check the images widht, height and size in asp code?

Please help.

Thanks.
0
Comment
Question by:ht055
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 53

Accepted Solution

by:
Ryan Chong earned 120 total points
ID: 7124057
0
 
LVL 2

Expert Comment

by:zombeen
ID: 7124296
ASPImage is anotyher very good component , used for this + a lot of other things
u shd get that one too from www.serverobjects.com
0
 
LVL 9

Expert Comment

by:AlfaNoMore
ID: 7126424
OR...

Sub getJPEGDimensions(ByVal filename, ByRef width, ByRef height)
     '// sets width and height to the values scooped from the JPEG referenced by filename
     '// Assumes filename supplies a full path (i.e. it has been MapPath'ed)

     Dim lBinPrefix
     Dim lLngStart
     Dim binaryData, objFS, objFile
     
     'filename = Server.MapPath(filename)
     Set objFS = Server.CreateObject("Scripting.FileSystemObject")
     
     Set objFile = objFS.OpenTextFile(filename)
     If Not objFile.AtEndOfStream Then
          binaryData = ChrB(Asc(objFile.Read(1)))
          While Not objFile.AtEndOfStream
                binaryData = binaryData & ChrB(Asc(objFile.Read(1)))
          Wend
     End If
     objFile.Close
     Set objFile = Nothing
     Set objFS = Nothing
     
     
     ' Prefix found before image dimensions          
     lBinPrefix = ChrB(&h00) & ChrB(&h11) & ChrB(&h08)
     
     ' Find the last prefix (so we don't confuse it with data)          
     lLngStart = 1
     Do
          If InStrB(lLngStart, binaryData, lBinPrefix) + 3 = 3 Then Exit Do
          lLngStart = InStrB(lLngStart, binaryData, lBinPrefix) + 3
     Loop
     ' If a prefix was found
     If Not lLngStart = 1 Then
          width = CLng("&h" & HexAt(lLngStart+2, binaryData) & HexAt(lLngStart+3, binaryData))
          height = CLng("&h" & HexAt(lLngStart, binaryData) & HexAt(lLngStart+1, binaryData))
     End If
End Sub


Function HexAt(ByRef pLngPosition, ByRef mStrBinaryData)
     If pLngPosition > LenB(mStrBinaryData) Or pLngPosition <= 0 Then Exit Function
     HexAt = Right("0" & Hex(AscB(MidB(mStrBinaryData, pLngPosition, 1))), 2)
End Function

0

Featured Post

How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question