Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Download the Jquery SDK <strong>and</strong> the server sdk.</p> <p>Here is the code with a java server side :</p> <h2>Generating the signature on server side : </h2> <p>Here is the JSP code in java :</p> <pre><code>&lt;%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%&gt; &lt;%@ page import="java.util.Map" %&gt; &lt;%@ page import="java.util.HashMap" %&gt; &lt;%@ page import="java.sql.Timestamp" %&gt; &lt;%@ page import="com.cloudinary.Cloudinary" %&gt; &lt;% String timestamp=(new Long(System.currentTimeMillis() / 1000L)).toString(); Cloudinary cloudinary = new Cloudinary("cloudinary://CLOUDINARY_URL"); Map&lt;String, Object&gt; params = new HashMap&lt;String, Object&gt;(); Map options = Cloudinary.emptyMap(); boolean returnError = Cloudinary.asBoolean(options.get("return_error"), false); String apiKey = Cloudinary.asString(options.get("api_key"), cloudinary.getStringConfig("api_key")); if (apiKey == null) throw new IllegalArgumentException("Must supply api_key"); String apiSecret = Cloudinary.asString(options.get("api_secret"), cloudinary.getStringConfig("api_secret")); if (apiSecret == null) throw new IllegalArgumentException("Must supply api_secret"); params.put("callback", "http://www.mcbjam.com/Scripts/vendor/cloudinary/html/cloudinary_cors.html"); params.put("timestamp", timestamp); String expected_signature = cloudinary.apiSignRequest(params, apiSecret);%&gt; </code></pre> <p>You can have the CLOUDINARY_URL on your Cloudinary Dashboard. I use the cloudinary.apiSignRequest method wich is include in server cloudinary sdk. I sign the callback and the timestamp. </p> <h2>The HTML and Javascript </h2> <pre><code>&lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"&gt; &lt;title&gt;Insert title here&lt;/title&gt; &lt;script src="../Scripts/vendor/jquery-1.9.1.min.js"&gt;&lt;/script&gt; &lt;script src="../Scripts/vendor/cloudinary/jquery.ui.widget.js"&gt;&lt;/script&gt; &lt;script src="../Scripts/vendor/cloudinary/jquery.iframe-transport.js"&gt;&lt;/script&gt; &lt;script src="../Scripts/vendor/cloudinary/jquery.fileupload.js"&gt;&lt;/script&gt; &lt;script src="../Scripts/vendor/cloudinary/jquery.cloudinary.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;script type="text/javascript"&gt; $.cloudinary.config({"api_key":"YOUR_API_KEY","cloud_name":"YOUR_CLOUD_NAME"}); &lt;/script&gt; &lt;input name="file" type="file" id="uploadinput" class="cloudinary-fileupload" data-cloudinary-field="image_upload" data-form-data="" &gt;&lt;/input&gt; &lt;script&gt; var data = { "timestamp": &lt;%= timestamp %&gt;, "callback": "http://YOUR_DOMAIN/cloudinary_cors.html", "signature": "&lt;%= expected_signature %&gt;", "api_key": "YOUR API KEY" }; $('#uploadinput').attr('data-form-data', JSON.stringify(data)); &lt;/script&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p>Put the cloudinary_cors.html on your host and modify the path on the html. Set your APIKEY and your cloud name.</p> <p>&lt;%= timestamp %> and &lt;%= expected_signature %> are the element calculate on java. ( You can do the same on php).</p> <p>I use this code on my website here <a href="http://paint.mcbjam.com" rel="nofollow">http://paint.mcbjam.com</a> You have more details here : <a href="http://mcbjam.blogspot.fr/2013/05/integrer-cloudinary-pour-realiser-des.html" rel="nofollow">http://mcbjam.blogspot.fr/2013/05/integrer-cloudinary-pour-realiser-des.html</a> in French.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload