2016-03-07 08:54:14 -08:00
|
|
|
// imgprovider.go
|
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"image"
|
|
|
|
"strconv"
|
2016-03-21 22:03:46 -07:00
|
|
|
"strings"
|
2016-03-07 08:54:14 -08:00
|
|
|
)
|
|
|
|
|
2016-03-11 09:56:45 -08:00
|
|
|
var imgready = false
|
2016-03-07 08:54:14 -08:00
|
|
|
|
|
|
|
func imgProvider(id string, width, height int) image.Image {
|
2016-03-21 22:03:46 -07:00
|
|
|
if imgready && (len(id) > 0) {
|
|
|
|
//fmt.Println("source (provider): ", id)
|
|
|
|
i1 := strings.Index(id, `;`)
|
|
|
|
i, _ := strconv.Atoi(id[:i1])
|
2016-03-11 09:56:45 -08:00
|
|
|
return slides[i].getImage(width, height)
|
|
|
|
|
|
|
|
} else {
|
|
|
|
var img1 image.Image = image.NewRGBA(image.Rect(0, 0, 340, 480))
|
|
|
|
return img1
|
|
|
|
}
|
2016-03-07 08:54:14 -08:00
|
|
|
}
|