Skip to content
This repository has been archived by the owner on Mar 25, 2020. It is now read-only.

Develop with ICP

hamzahalhariri edited this page Mar 26, 2018 · 1 revision

How to use

In your plugin you need to send an event to the ICP agent in order the get a handler to get your provider

this.icp = undefined
 
this.ready('se.infomaker.icp', () => {
    this.on('se.infomaker.icp:ICPLib', userData => {
        let ICP = userData.ICP
        let handler = new ICP()                

        this.icp = handler.getImageProvider('name-of-image-provider') // i.e. "imengine-provider" from example config
        
        let imgSrc = this.icp.getImageSrc('crop', {
            identifier: "123e4567-e89b-12d3-a456-426655440000",
            width: 400,
            height: 300,
            x: 20,
            y: 45	
        })
         
        // imgSrc == https://domain/imengine/image.php?uuid=123e4567-e89b-12d3-a456-426655440000&type=preview&function=cropresize&width=400&height=300&x=20&y=45&crop_w=400&crop_h=300&q=80
    })
    
    this.send('se.infomaker.icp:getICPLib') 
})
Clone this wiki locally