Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

About Scaling Down Photo's Visible through http://

Status
Not open for further replies.

NewYorkFashionToGo

Programmer
Oct 20, 2006
44
US
I have a question about scaling down photo's via VBA Module. I created a module that has this code in it for displaying pictures on a form and all works perfectly well. I just upload the data in a text box. and Picture Dislays. except I would like to make images smaller. It is alot of work to put photos together and I will double my work and space if I have to make thumbnails as well as the picture I want to display on the web. I am using the web display and would like to scale everything down. I can make the box on form smaller but the image is the same size and doesnt display properly. Is there a scale down function in VBA???

The Code in the Module is:

Public Function DisplayImageWeb(ctlBrowserControl As Control, _
strImagePath As Variant)

On Error GoTo Err_DisplayImage

Dim strDatabasePath As String
Dim intSlashLocation As Integer

With ctlBrowserControl
If IsNull(strImagePath) Then
ElseIf Left(strImagePath, 4) = "http" Then
.Navigate (strImagePath)
Else
If InStr(1, strImagePath, "\") = 0 Then
' Path is relative
strDatabasePath = CurrentProject.FullName
intSlashLocation = InStrRev(strDatabasePath, "\", Len(strDatabasePath))
strDatabasePath = Left(strDatabasePath, intSlashLocation)
strImagePath = strDatabasePath & strImagePath
End If
.Navigate (strImagePath)
End If
End With

Exit_DisplayImage:
Exit Function

Err_DisplayImage:
Select Case Err.Number
Case Else
MsgBox Err.Number & " " & Err.Description
Resume Exit_DisplayImage:
End Select
End Function


And The code In The form Is:

Option Compare Database
Option Explicit

Private Sub Form_AfterUpdate()
CallDisplayImage
End Sub

Private Sub Form_Current()
CallDisplayImage
End Sub

Private Sub Image_3_AfterUpdate()
CallDisplayImage
End Sub

Private Sub CallDisplayImage()
DisplayImageWeb Me.WebBrowser9, Me.Image_3
End Sub


Private Sub WebBrowser9_Updated(Code As Integer)

End Sub
 
Simplay change the 'size mode' to 'stretch' on your image control.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
I do see what you are talking about in The image control, However I am using the web browser control, It does not have that option on it to do what you are saying. I couldnt get it to work using HTTP on the image control, Is there a way to make it work using that option.
 
I would think this would be accomplished with the HTML you load into the browser control, probably attributes of the IMG tag (maybe "height" and "width"?).

I'm not an HTML expert by any stretch of imagination, however, so I might be completely wrong.
 
My mistake. Haven't used the browser control.

Greg
"Personally, I am always ready to learn, although I do not always like being taught." - Winston Churchill
 
I guess you could mess about a bit:

Code:
With ctlBrowserControl
    If IsNull(strImagePath) Then
    ElseIf Left(strImagePath, 4) = "http" Then
        .Navigate (strImagePath)
    Else
        If InStr(1, strImagePath, "\") = 0 Then
            ' Path is relative
            strDatabasePath = CurrentProject.FullName
            intSlashLocation = InStrRev(strDatabasePath, "\", Len(strDatabasePath))
            strDatabasePath = Left(strDatabasePath, intSlashLocation)
            strImagePath = strDatabasePath & strImagePath
        End If[blue]
        strImgHTM = "C:\Docs\img.htm"
        Open "img.htm" For Output As #1
        Print #1, "<html><head></head><body style=""zoom: 40%"">"
        Print #1, "<img src=" & Chr(34) & strImagePath & Chr(34) & " />"
        Print #1, "</body></html>"
        Close #1
        .Navigate (strImgHTM)[/blue]
    End If
End With
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top