Wednesday, November 5, 2014

Dynamic Photo Framing API

Today bonus is to introduce photo framing api(apisilo.com) for framing industry. It is easy to use as you just need to pass four parameters which is art, frametop, framebtm, and framesize.

Parameter values and file format:
art - Photo or the artwork you wish to frame (only jpg, gif, png file format)
frametop - small piece of frame image, please see sample. (only jpg, gif, png file format)
framebtm - small piece of frame image, please see sample. (only jpg, gif, png file format)
framesize - integer value that you wish to control frame thickness.

How to use it:

Use with jquery getJSON to call API

$.getJSON("http://frame.apisilo.com/index.php?jsoncallback=?",
    {
      art: "http://www.tourismeoutaouais.com/blogue/wp-content/uploads/2014/10/halloween2-620x350.jpg",
      frametop: "http://www.imagemagick.org/Usage/thumbnails/blackthin_btm.gif",
      framebtm: "http://www.imagemagick.org/Usage/thumbnails/blackthin_btm.gif",
      framesize:"50"
    },
    function(data) {
        var str = data['result'];
        var finalData = str.replace(/\\/gi, '');

        $("#framed_artwork").attr("src",finalData);
    });

Append the result in framed_artwork as following:
<img id="framed_artwork" src="sample.jpg" />


DEMO

No comments:

Post a Comment