I am attempting to draw a web picture from a URL stored in my database that on login the URL is saved to Session String Parameter.
Logically in my head this code makes sense. But I get nothing. Not even the MsgBox on fail.
Help?
dim p as new picture(150,150)
Dim picFolder As New FolderItem(Session.Picture)
If picFolder<> Nil And picFolder.Exists Then
Dim pic As New WebPicture(picFolder)
p.graphics.drawpicture(pic,0,0,p.Width,p.Height,0,0,pic.Width,pic.Height)
Me.Picture = p
Else
MsgBox "Nope"
End If
This line really should have given you an UnsupportedFormatException when you passed it a remote URL and not a file path: FolderItem — Xojo documentation
It does not appear to be possible within the framework. You could file a ticket requesting the feature.
It may be possible with ExecuteJavascript but the inner-div of an image viewer doesn’t have an ID, so it’s going to require a little bit of poking around to write something. The core of the issue is we need to set the inner-div CSS to use background-size: contain.
It might be as simple as using the firstChild but you may need to do it on every image load. @Ricardo_Cruz might have some useful insight. I can come back to this later, but during the day I pop onto the forum while I’m waiting on Xojo (and don’t have tons of time to play).
Edit: I’ve just found this old case, Issue #39829. I can’t see the posted images anymore, but it looks like that feature request should be more or less what you’ve mentioned @Tim_Parnell .
IMO that should be the default whenever displaying an image using the URL parameter. It is the only way to correctly display a HiDPI image.
But a framework option would be great.