Documentation ¶
Overview ¶
************************************************************** * * GAE Go automatic blob image optimizer * * Created by Tomi Hiltunen 2013. * http://www.linkedin.com/in/tomihiltunen * * https://github.com/TomiHiltunen/GAE-Go-image-optimizer * * - Use this script however you wish. * - Do not remove any copyrights/comments on any files included. * - All use is on your own risk. * * Intented use: * - Drop-in replacement for GAE's blobstore.ParseUploads(...) * - Automatically optimized any images uploaded * to Google App Engine blobstore. * - Reduces data amount in the blobstore. * - Reduces download times. * * * Modified by David Benque in order to keep png format for transparency * * **************************************************************
Index ¶
- func CreateTasksToDeleteImages(context appengine.Context, q *datastore.Query, baseurl string) error
- func NewCompressionOptions(r *http.Request) *compressionOptions
- func ParseBlobs(options *compressionOptions) (blobs map[string][]*blobstore.BlobInfo, other url.Values, err error)
- func Resample(m image.Image, r image.Rectangle, w, h int) image.Image
- func Resize(m image.Image, r image.Rectangle, w, h int) image.Image
- type ImageInGAE
- type ImgProfile
- type ImgProfileNameSet
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewCompressionOptions ¶
* Create new set of options. * * - Sets Quality to 75 as default. 75 is highly compressed but not visually noticable. * - Sets Size to 0 which means that no changes to images dimensions will be made. * - Creates new App Engine context.
func ParseBlobs ¶
func ParseBlobs(options *compressionOptions) (blobs map[string][]*blobstore.BlobInfo, other url.Values, err error)
* This one does the magic. * * - Gets the uploaded blobs by calling blobstore.ParseUpload() * - Maintains all other values that come from blobstore. * - Hands out the results for further processing.
Types ¶
type ImageInGAE ¶
type ImageInGAE struct { EntityId string `json:"entityId"` ProfileName string `json:"profileName"` BlobstoreKey string `json:"blobstoreKey" datastore:",noindex"` }
func (*ImageInGAE) GetKey ¶
func (p *ImageInGAE) GetKey() string
func (*ImageInGAE) GetKind ¶
func (p *ImageInGAE) GetKind() string
type ImgProfile ¶
type ImgProfile struct { Name string `json:"name"` Quality int `json:"quality" datastore:",noindex"` MaxSize int `json:"maxSize" datastore:",noindex"` }
func (*ImgProfile) GetKey ¶
func (p *ImgProfile) GetKey() string
func (*ImgProfile) GetKind ¶
func (p *ImgProfile) GetKind() string
type ImgProfileNameSet ¶
type ImgProfileNameSet struct {
Index sort.StringSlice `json:"index"` // Index of profiles
}
func GetImgProfileNameSet ¶
func GetImgProfileNameSet(context appengine.Context) ImgProfileNameSet
retrieve the index of profiles (initialize the key if nil)