wow that took awhile
This commit is contained in:
38
cmd/test-image-upload/main.go
Normal file
38
cmd/test-image-upload/main.go
Normal file
@@ -0,0 +1,38 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
bkosmi "github.com/42wim/matterbridge/bridge/kosmi"
|
||||
"github.com/42wim/matterbridge/bridge/jackbox"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println("=== Kosmi Image Upload Test ===\n")
|
||||
|
||||
// Test 1: Generate a room code image
|
||||
fmt.Println("1. Generating room code image for 'TEST'...")
|
||||
imageData, err := jackbox.GenerateRoomCodeImage("TEST")
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to generate image: %v", err)
|
||||
}
|
||||
fmt.Printf(" ✓ Generated image (%d bytes)\n\n", len(imageData))
|
||||
|
||||
// Test 2: Upload the image to Kosmi CDN
|
||||
fmt.Println("2. Uploading image to Kosmi CDN (https://img.kosmi.io/)...")
|
||||
imageURL, err := bkosmi.UploadImage(imageData, "roomcode_TEST.png")
|
||||
if err != nil {
|
||||
log.Fatalf("Failed to upload image: %v", err)
|
||||
}
|
||||
fmt.Printf(" ✓ Upload successful!\n\n")
|
||||
|
||||
// Test 3: Display the result
|
||||
fmt.Println("=== RESULT ===")
|
||||
fmt.Printf("Image URL: %s\n\n", imageURL)
|
||||
fmt.Println("Next steps:")
|
||||
fmt.Println("1. Open the URL in your browser to verify the image")
|
||||
fmt.Println("2. Send this URL to Kosmi chat via WebSocket")
|
||||
fmt.Println("3. Kosmi will display it as a thumbnail")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user