-
Notifications
You must be signed in to change notification settings - Fork 0
/
image.go
36 lines (30 loc) · 802 Bytes
/
image.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package app
import (
"html/template"
"log"
"net/http"
)
type webinarImageData struct {
SeriesName string
WebinarTitle string
WebinarDate string
}
type image struct{}
func (i image) ServeHTTP(w http.ResponseWriter, r *http.Request) {
seriesName := r.URL.Query().Get("series_name")
webinarTitle := r.URL.Query().Get("webinar_title")
webinarDate := r.URL.Query().Get("webinar_date")
tmpl, err := template.New("").ParseFiles("./templates/rocket_image.html")
if err != nil {
log.Printf("Error in parsing template. Err: %v", err)
}
data := webinarImageData{
SeriesName: seriesName,
WebinarTitle: webinarTitle,
WebinarDate: webinarDate,
}
err = tmpl.ExecuteTemplate(w, "rocket_image.html", data)
if err != nil {
log.Printf("Error in parsing template. ERr: %v", err)
}
}