[AccessD] Function to get dimensions of Image file

Mike Mattys mmattys at rochester.rr.com
Mon Jun 29 09:39:26 CDT 2009


Hi Myke,

This must be your formula without use of API requisites ... right?
Where does 26.4583 come from?

-
Michael R Mattys
MapPoint and Database Dev
www.mattysconsulting.com
-

----- Original Message ----- 
From: "Myke Myers" <mmm at tbig.com>
To: "'Database Advisors'" <accessd at databaseadvisors.com>
Sent: Monday, June 29, 2009 10:24 AM
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