A Image Editor for resize and crop images and return dataurl or blob or a recipe for CDN usage. No file upload funciton at all.
Html editor:
<div sup-image-editor></div>
Angular directive :
<div sup-image-editor options="{'cors':'false'}"
img-src-url="image_src" img-recipe="media.recipe"></div>
- img-src-url: image src
- img-recipe: A recipe return by
recipe()
. it's for restore the crop area. - options
- corner_size: [ int ] corner size in px, default is 12
- crop_min_size: [ int ] minimal corp size in px, default is 32
- cors: true: [ bool ] cross orgian support for
<img>
-
init: init editor
- editor: [ str ] for the div
name
or [ htmlElement ] for the div. - opt: [ int ] (optional) options will update default options.
- is_debug: [ bool ] (optional) start with debug.
- editor: [ str ] for the div
-
load: load image
- img_src: [ str ] image src, could use
dataurl
. - recipe: [ dict ] (optional) recipe create by this editor, returned by function
recipe()
.
- img_src: [ str ] image src, could use
-
reload: reload image
- img_src: [ str ] (optional) image src, could use
dataurl
. Use last image src url if not give.
- img_src: [ str ] (optional) image src, could use
-
unload: unload editor, clean up image and listeners, ready to reload.
-
recipe: return a recipe, it cloud be work with cdn resize/crop.
-
mimetype: get image mimetype.
-
scale: scale image
- aspect_ratio: percent of image resize.
-
capture: capture image and return a Dataurl.
- mimetype: (optional) image mimetype, if not give editor make a guess.
- encoder: (optional) encoder for the image quality, jpg only.
-
capture_blob: capture image and return a blob.
- media: [ dict ] (optional) media information. must has:
type
,name
,media.lastModified
,media.lastModifiedDate
. - encoder: [ float ] (optional) encoder for the image quality, jpg only.
- media: [ dict ] (optional) media information. must has:
-
blob: complie dataurl to blob.
- media: [ dict ] (optional) media information. must has:
type
,name
,media.lastModified
,media.lastModifiedDate
. - dateurl: [ dateurl ] media file with data url format.
- media: [ dict ] (optional) media information. must has:
-
destroy: destroy editor clean up everything.
-
hooks:
- loaded: register hook for loaded.
Angular directive might not need: init
, load
, unload
, hooks
, destory