Documentation
¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Thumbnail ¶
Thumbnail generates a thumbnail image representing this postcard's front. Providing a maximum width or height of zero will allow the thumbnail to grow up to the postcard's original size in that dimension.
func ThumbnailFile ¶
ThumbnailFile is a convenience method for retrieving a thumbnail directly on a file using Thumbnail.
Example ¶
package main import ( "bytes" "crypto/md5" "fmt" "image/png" "github.com/dotpostcard/postcards-go/adapt" ) func main() { thumb, err := adapt.ThumbnailFile("../fixtures/hello.postcard", 128, 0) if err != nil { panic(err) } buf := new(bytes.Buffer) if err := png.Encode(buf, thumb); err != nil { panic(err) } fmt.Printf("Thumbnail PNG (%dx%d) has checksum %x", thumb.Bounds().Dx(), thumb.Bounds().Dy(), md5.Sum(buf.Bytes())) }
Output: Thumbnail PNG (128x157) has checksum eba1acbde60137aff808c9783c05706d
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.