[AccessD] Function to get dimensions of Image file

Max Wanadoo max.wanadoo at gmail.com
Mon Jun 29 10:40:58 CDT 2009


Hi Myke,
Where would you use this?
Looks useful, just need some example of where you use it.

thanks

Max



-----Original Message-----
From: accessd-bounces at databaseadvisors.com
[mailto:accessd-bounces at databaseadvisors.com] On Behalf Of Myke Myers
Sent: 29 June 2009 15:24
To: 'Database Advisors'
Subject: [AccessD] Function to get dimensions of Image file

'---------------------------------------------------------------------------
------------
' Procedure : fGetImageDimensions
' DateTime  : 6/27/2009 15:55
' Author    : mmmyers
' Purpose   : uses image pathfilename to get width x height in pixels
'---------------------------------------------------------------------------
------------
'
Public Function fGetImageDimensions(strImagePathFilename As String) As
String
Dim objImage As Object
Dim fs As Object
Dim iWidth As Integer
Dim iHeight As Integer
On Error GoTo fGetImageDimensions_Error    'modImages.fGetImageDimensions

Set fs = CreateObject("Scripting.FileSystemObject")
If Not fs.FileExists(strImagePathFilename) Then Exit Function
Set objImage = LoadPicture(strImagePathFilename)
iWidth = Round(objImage.Width / 26.4583)
iHeight = Round(objImage.Height / 26.4583)
fGetImageDimensions = iWidth & "x" & iHeight

ExitHere:
  Set objImage = Nothing
  Set fs = Nothing
   Exit Function

fGetImageDimensions_Error:
  Select Case Err.Number
    Case Else
      MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical,
"modImages.fGetImageDimensions"
  End Select
Resume ExitHere
'When the messagebox for the error appears, press Ctrl-Break to debug
Resume   'Click on this line and press Ctrl-F9 for debugging
' End Error handling block.    tbig v1.1

End Function

-- 
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com




More information about the AccessD mailing list