0

We have thousands of products and the product information is stored on the database. The images for the products are stored on a network hard drive. Pulling the images, sizing and displaying them on a grid with product information for a quote that has over 900 different products took so long that although it completed the code, it did not completely paint the display.

        If webcontent IsNot Nothing Then
        itemRow.ItemWebHead = webcontent.WebHead
        Dim imgNames As String = webcontent.ImageName
        Dim imgNamesCol As New List(Of String)(Split(imgNames, VM))
        itemRow.ImageConfig = New dataSourceQuote.PictureBoxConfig(imgNamesCol)
        If imgNamesCol.Count = 1 Then
            itemRow.ImagePath = ImgHelperClass.WebImagePath + ImgHelperClass.SetImageFileWithRes(imgNamesCol(0), ImgHelperClass.WebImageRes)
        ElseIf imgNamesCol.Count > 1 Then
            itemRow.ImagePath = ImgHelperClass.WebImagePath + ImgHelperClass.SetImageFileWithRes(imgNamesCol(0), ImgHelperClass.WebImageRes)
        ElseIf imgNamesCol.Count = 0 Then
            itemRow.ImagePath = ImgHelperClass.strSaveLocation + "\" + ImgHelperClass.ImageNotAvailable
        End If

        itemRow.Description = Me.GetSpecsString(webcontent)

    Else
        itemRow.ImageConfig = New dataSourceQuote.PictureBoxConfig(Nothing)
        itemRow.ImagePath = ImgHelperClass.strSaveLocation + "\" + ImgHelperClass.ImageNotAvailable
    End If

Would it be faster if the images were stored on a SQL database instead of a network drive?

  • What sort of grid? Is it DGV? Have you considered only showing what's actually visible (Virtual mode)? – Charlieface Jan 17 '21 at 21:34
  • Download only images that fit on the window and process them to reduce its size to the appropriate size. Are you downloading 5Mb images and showing them in a 200x200 picture box? or something like that? – Jesús López Jan 17 '21 at 22:00
  • Rather than burning server CPU scaling images while servicing every web request have you considered storing the the scaled images in a persistent cache? Or even prescaling them in a directory hierarchy with say original, 1/4 and thumbnail scales? – AlwaysLearning Jan 18 '21 at 10:26

0 Answers0