Groovy Documentation

grails-app.services.pl.burningice.plugins.image
Class ImageUploadService

java.lang.Object
  grails-app.services.pl.burningice.plugins.image.ImageUploadService

class ImageUploadService

Service for image upload handling

author:
pawel.gdula@burningice.pl


Property Summary
private def actionMapping

Map configuration key to action in this service

BurningImageService burningImageService

ContainerWorkerFactory containerWorkerFactory

ResourcePathProvider resourcePathProvider

private def scaleImage

Performs scaling on image

boolean transactional

private def watermarkImage

Performs watermarking on image

 
Constructor Summary
ImageUploadService()

 
Method Summary
ImageContainer delete(ImageContainer imageContainer, def shouldBeSaved = false)

Allows to delete images associated with specified domain object

private ImageContainer execute(ImageContainer imageContainer, MultipartFile uploadedImage, groovy.lang.Closure actionWrapper)

Execute actions on image

private def executeOnImage(def image, def subImageOperations)

Perform specified chain of modification configured by the user

def save(ImageContainer imageContainer)

Perfrom save/update of image.

def save(ImageContainer imageContainer, boolean shouldBeSaved)

def save(ImageContainer imageContainer, groovy.lang.Closure actionWraper)

def save(ImageContainer imageContainer, boolean shouldBeSaved, groovy.lang.Closure actionWraper)

 
Methods inherited from class java.lang.Object
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll
 

Property Detail

actionMapping

private def actionMapping
Map configuration key to action in this service


burningImageService

BurningImageService burningImageService


containerWorkerFactory

ContainerWorkerFactory containerWorkerFactory


resourcePathProvider

ResourcePathProvider resourcePathProvider


scaleImage

private def scaleImage
Performs scaling on image
param:
image Image on witch scaling should be performed
param:
params Scaling parameters


transactional

boolean transactional


watermarkImage

private def watermarkImage
Performs watermarking on image
param:
image Image on witch watermarking should be performed
param:
params Scaling parameters


 
Constructor Detail

ImageUploadService

ImageUploadService()


 
Method Detail

delete

ImageContainer delete(ImageContainer imageContainer, def shouldBeSaved = false)
Allows to delete images associated with specified domain object
param:
imageContainer Domain object marked by FileImageContainer annotation
param:
shouldBeSaved Delineate if specified domain object should be saved (optional)
return:
FileImageContainer updated image container


execute

private ImageContainer execute(ImageContainer imageContainer, MultipartFile uploadedImage, groovy.lang.Closure actionWrapper)
Execute actions on image
param:
imageContainer Domain object marked by FileImageContainer annotation
param:
uploadedImage Image that should be stored
param:
actionWrapper Closure that allow user to wrap predefined action by some additional steps (optional)
return:
FileImageContainer updated image container


executeOnImage

private def executeOnImage(def image, def subImageOperations)
Perform specified chain of modification configured by the user
param:
image Image that is modified
param:
subImageOperations Configuration of specified modifications


save

public def save(ImageContainer imageContainer)
Perfrom save/update of image. Use configuration data to specify how many images should be created and what type of actions should be performed. Exanple configuration CH.config.bi.MyDomain = [ outputDir: '/path/to/outputDir', {nullable = false, blank = false, exists = true} prefix: '/path/to/outputDir', {nullable = true, blank = false} images: ['small':[scale:[width:xx, height:yy, type[e:SCALE_ENGINE]] 'medium:[scale:[width:xx, height:yy, type:SCALE_ENGINE], watermark:[sign:'/path/to/watermark', offset:[valid offset]]], 'large':[scale:[width:xx, height:yy, type:SCALE_ENGINE], watermark:[sign:'/path/to/watermark', offset:[valid offset]]] ] ]
param:
imageContainer Domain object marked by FileImageContainer annotation
param:
shouldBeSaved Delineate if specifed domain object should be saved (optional)
param:
actionWraper Closure that allow user to wrap prediefined action by some additional steps (optional)
return:
FileImageContainer updated image container


save

public def save(ImageContainer imageContainer, boolean shouldBeSaved)


save

public def save(ImageContainer imageContainer, groovy.lang.Closure actionWraper)


save

public def save(ImageContainer imageContainer, boolean shouldBeSaved, groovy.lang.Closure actionWraper)


 

Groovy Documentation