示例#1
0
func chainProcImg(catinstance cat.Cat, chain *proc.ProcessorChain, img *img4g.Image) (err error) {
	defer func() {
		if r := recover(); r != nil {
			log.WithFields(log.Fields{
				"type": "ProcessImage.Panic",
			}).Error(fmt.Sprintf("%v", r))
			LogErrorEvent(catinstance, "ProcessImage.Panic", fmt.Sprintf("%v", r))
		}
	}()
	defer img.DestoryWand()
	if err = img.CreateWand(); err != nil {
		return
	}
	if err = chain.Process(img); err != nil {
		return
	}
	err = img.WriteImageBlob()
	return
}
示例#2
0
func chainProcImg(chain *proc.ProcessorChain, img *img4g.Image) (err error) {
	defer func() {
		if r := recover(); r != nil {
			err = r.(error)
			log("imagehandler->chainprocimg", r)
		}
	}()
	defer img.DestoryWand()
	if err = img.CreateWand(); err != nil {
		return err
	}
	if err = chain.Process(img); err != nil {
		return err
	}
	if err = img.WriteImageBlob(); err != nil {
		return err
	}
	return nil
}