GenerateImageSignedURL
Generate a signed URL that can be used to generate images on-demand without making API calls. Perfect for dynamic content in emails, web pages, and more.
func ( c * BannerifyClient ) GenerateImageSignedURL (
templateID string ,
opts * CreateImageOptions ,
) ( string , error )
Parameters
The template ID (e.g., ‘tpl_xxxxxxxxx’)
Optional configuration Array of modifications to apply to the template
Output format: “png” or “svg”
Generate thumbnail version
Returns
Returns a signed URL string or error.
string // e.g., "https://api.bannerify.co/v1/templates/signedurl?..."
error // error if URL generation fails
Examples
Basic Signed URL
package main
import (
" fmt "
" github.com/bannerify/bannerify-go "
)
func main () {
client := bannerify . NewBannerifyClient ( "your-api-key" )
signedURL , err := client . GenerateImageSignedURL ( "tpl_xxxxxxxxx" , nil )
if err != nil {
panic ( err )
}
fmt . Printf ( "<img src=' %s ' alt='Generated Image' />" , signedURL )
}
With Modifications
signedURL , err := client . GenerateImageSignedURL ( "tpl_xxxxxxxxx" , & bannerify . CreateImageOptions {
Modifications : [] bannerify . Modification {
{ Name : "title" , Text : "Dynamic Title" },
{ Name : "subtitle" , Text : "Generated on the fly" },
},
})
if err == nil {
fmt . Printf ( "<img src=' %s ' alt='Dynamic Banner' />" , signedURL )
}
signedURL , err := client . GenerateImageSignedURL ( "tpl_xxxxxxxxx" , & bannerify . CreateImageOptions {
Format : "svg" ,
Modifications : [] bannerify . Modification {
{ Name : "title" , Text : "SVG Image" },
},
})
Use Cases
Email Campaigns
Generate personalized images in emails:
recipients := [] struct {
Name string
Email string
}{
{ "Alice" , "[email protected] " },
{ "Bob" , "[email protected] " },
}
for _ , recipient := range recipients {
signedURL , _ := client . GenerateImageSignedURL ( "tpl_email_header" , & bannerify . CreateImageOptions {
Modifications : [] bannerify . Modification {
{ Name : "name" , Text : fmt . Sprintf ( "Hi, %s !" , recipient . Name )},
},
})
html := fmt . Sprintf ( "<img src=' %s ' alt='Personalized Header' />" , signedURL )
// Send email with html
}
Dynamic Open Graph Images
Generate OG images for social media sharing:
func GetOGImageURL ( title , author string ) string {
client := bannerify . NewBannerifyClient ( "your-api-key" )
signedURL , err := client . GenerateImageSignedURL ( "tpl_og_image" , & bannerify . CreateImageOptions {
Modifications : [] bannerify . Modification {
{ Name : "title" , Text : title },
{ Name : "author" , Text : author },
},
})
if err != nil {
return ""
}
return signedURL
}
// In your HTML template
ogImage := GetOGImageURL ( "My Blog Post" , "John Doe" )
// <meta property="og:image" content="{ogImage}" />
Real-time Analytics Badges
import " strconv "
stats := map [ string ] int {
"views" : 1234 ,
"likes" : 567 ,
"shares" : 89 ,
}
badgeURL , _ := client . GenerateImageSignedURL ( "tpl_stats_badge" , & bannerify . CreateImageOptions {
Modifications : [] bannerify . Modification {
{ Name : "views" , Text : strconv . Itoa ( stats [ "views" ])},
{ Name : "likes" , Text : strconv . Itoa ( stats [ "likes" ])},
{ Name : "shares" , Text : strconv . Itoa ( stats [ "shares" ])},
},
})
fmt . Printf ( "[](https://example.com)" , badgeURL )
User Profile Cards
func GenerateProfileCard ( userID , name , avatar string ) ( string , error ) {
client := bannerify . NewBannerifyClient ( "your-api-key" )
return client . GenerateImageSignedURL ( "tpl_profile_card" , & bannerify . CreateImageOptions {
Modifications : [] bannerify . Modification {
{ Name : "user_name" , Text : name },
{ Name : "avatar" , Src : avatar },
{ Name : "user_id" , Text : userID },
},
})
}
profileURL , _ := GenerateProfileCard ( "123" , "Jane Smith" , "https://example.com/avatar.jpg" )
Benefits
No API Calls - Images are generated only when accessed
CDN Caching - Subsequent requests are served from cache
Security - URLs are signed and can’t be tampered with
Flexibility - Perfect for emails, OG images, and dynamic content
Cost Effective - Only generates when actually viewed