I have just inserted the Listview Image Gallery in my site and is working properly.
The Gallery is getting the data from the proper folder however I need it to retrieve the information or images of the Current Logged in user.
I generally accomplish this in Listview with a SqlDatasource and a query of the current logged in UserId.
The Image gallery is getting the data in this manner and I am not sure what additions or changes I need to make to get it to Select based on logged in user UserId.
​Public Shared Function GetData() As IList(Of Photo)
If _photos IsNot Nothing Then
Return _photos
End If
_photos = New List(Of Photo)()
For Each file As String In Directory.GetFiles(HttpContext.Current.Server.MapPath("images/"))
Dim photo = New Photo()
photo.Name = Path.GetFileName(file)
Dim image__1 As Image = Image.FromFile(file)
Using memoryStream = New MemoryStream()
image__1.Save(memoryStream, ImageFormat.Png)
photo.Data = memoryStream.ToArray()
End Using
_photos.Add(photo)
Next
Return _photos
End Function
The Gallery is getting the data from the proper folder however I need it to retrieve the information or images of the Current Logged in user.
I generally accomplish this in Listview with a SqlDatasource and a query of the current logged in UserId.
The Image gallery is getting the data in this manner and I am not sure what additions or changes I need to make to get it to Select based on logged in user UserId.
​Public Shared Function GetData() As IList(Of Photo)
If _photos IsNot Nothing Then
Return _photos
End If
_photos = New List(Of Photo)()
For Each file As String In Directory.GetFiles(HttpContext.Current.Server.MapPath("images/"))
Dim photo = New Photo()
photo.Name = Path.GetFileName(file)
Dim image__1 As Image = Image.FromFile(file)
Using memoryStream = New MemoryStream()
image__1.Save(memoryStream, ImageFormat.Png)
photo.Data = memoryStream.ToArray()
End Using
_photos.Add(photo)
Next
Return _photos
End Function