Image retrieval

Retrieving the image sent from Picozu

When a visitor from your site opens Picozu and saves an image via Image -> Save, a message containing a special object gets posted to the parent page. This object can be intercepted via the code below:

<script>
        var eventMethod = window.addEventListener ? "addEventListener" : "attachEvent";
        var eventer = window[eventMethod];
        var messageEvent = eventMethod == "attachEvent" ? "onmessage" : "message";
        eventer(messageEvent, function(e) {
                // always check if the origin is the Picozu domain, https included.
                if (e.origin === 'https://www.picozu.com') {
                        // e.data contains the image properties, and you can construct the URL as following:
                        console.log('https://www.picozu.com/v/' + e.data.dir + e.data.code + '.' + e.data.format);
                }
        }, false);
</script>

The object returned from Picozu has the following structure :

{
        status: "ok",
        code: "vT7tvQHn89vOLFhtn21iKKba",
        title: "Image Title",
        format: "png",
        dir: "temp/"
}

The code parameter is a 24-char string that uniquely identifies your image. The dir parameter is always temp/ because all images are stored temporary on the Picozu server.

VERY IMPORTANT NOTE

You can only retrieve the image from Picozu if you use the iframe-embed method; if you open the image in a new tab/window,there is no way for Picozu to send the processed image link back to the original page. The image sent from Picozu is a temporary image (temporary images get removed from the server weekly), so it’s up to you to retrieve it and store it somewhere.

© 2011 - 2017 Picozu, The HTML5 Image Editor - Terms and Conditions - Privacy Policy

Forgot your details?