Thumbnail Retrieval

Hi Team, Does anyone knows how the thumbnail acmp commands works in version 2.3. from the media scanner documentation , /thumbnail, /thumbnail/name exist, but they are not working

IIRC it returns base64

1 Like

Can you associate an image as a thumbnail? I am thinking about HTML templates and their thumbnails.

In the older versions you should be able to simply create an image and put it in the thumbnails folder. Not sure how it’s with scanner in the newer versions.

So, there’s no way to retrieve the thumbnails with the latest versions of casparcg, via AMCP?

I came to know recently about this. Tried to make a sample application to make thumbnail in casparcg 2.3.
Application with source code is here.
https://drive.google.com/file/d/1mrf9FkdYgbp0MlX159rMHvcuNNJlLLWW/view?usp=sharing

4 Likes

hello leader please can you upload the file again thank you

I deleted the separeate project and included it in CMP tools=>make thumnail for server2.3.

I post the code here.

 Dim aa() As String
    Private Sub MakeThumbnailForServer23ToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles MakeThumbnailForServer23ToolStripMenuItem.Click
        On Error Resume Next
        Dim alreadyRunning As Integer
        Dim dd As New Process
        If ServerVersion > 2.1 Then
            If IfRunning("scanner") = False Then
                alreadyRunning = 5
                dd.StartInfo.FileName = initialpath & "\scanner.exe" '"C:\Users\vimlesh\Downloads\casparcg-server-050620\scanner.exe"
                dd.StartInfo.WorkingDirectory = initialpath ' "C:\Users\vimlesh\Downloads\casparcg-server-050620\"
                dd.Start()
                Threading.Thread.Sleep(5000)
            Else
                alreadyRunning = 2
            End If


            Dim webClient As New System.Net.WebClient
            Dim result As String = webClient.DownloadString("http://" & cmbhost.Text & ":8000/thumbnail")
            Dim bb() = Split(result, vbNewLine)
            ReDim aa(bb.Count)

            For iclips = 0 To bb.Count - 3
                Dim foldername As String = ""
                Dim clipname As String = Replace(Split(bb(iclips), "  ")(0), "\", "/")
                clipname = Split(clipname, """" & " ")(0)
                clipname = Replace(clipname, """", "")
                aa(iclips) = clipname
            Next
            aa = aa.Skip(1).ToArray

            For Each item As String In aa
                'Dim webClient As New System.Net.WebClient
                result = webClient.DownloadString("http://" & cmbhost.Text & ":8000/thumbnail/" & Replace(item, "/", "%2F"))
                bb = Split(result, vbNewLine)
                Dim filename As String = thumbnailsfullpath & "/" & item & ".png"
                Dim fi As New FileInfo(filename)

                Dim path As String = fi.DirectoryName
                If (Not System.IO.Directory.Exists(path)) Then
                    System.IO.Directory.CreateDirectory(path)
                End If
                ss(bb(1)).Save(filename)
            Next
            If alreadyRunning = 5 Then dd.Kill()
        End If
    End Sub
    Function ss(ff As String) As Image
        On Error Resume Next
        Dim gg As Image = Image.FromStream(New MemoryStream(Convert.FromBase64String(ff)))
        Return gg
    End Function
2 Likes

thank you ease and useful , good job :tulip:

1 Like