Note that there are some explanatory texts on larger screens.

plurals
  1. POHtml 5 file api & jcrop issue
    primarykey
    data
    text
    <p>I render a picture in local using html5 and File API.</p> <p><strong>html:</strong> </p> <pre><code>&lt;form action="/Picture/UpdateProfilePicture" id="profile_pic_form" method="post"&gt; &lt;input type="file" id="file"&gt;&lt;br&gt; &lt;/form&gt; &lt;div&gt; &lt;output id="result"&gt;&lt;/output&gt; &lt;/div&gt; </code></pre> <p><strong>javascript:</strong> </p> <pre><code>&lt;script type="text/javascript"&gt; function handleFileSelect(evt) { var files = evt.target.files; var file = files[0]; if (files[0].type.match('image.*')) { var reader = new FileReader(); reader.onload = (function (theFile) { return function (e) { // Render thumbnail. var span = document.createElement('span'); span.innerHTML = ['&lt;img id="cropbox" class="thumb" src="', e.target.result, '" title="', escape(theFile.name), '"/&gt;'].join(''); document.getElementById('result').innerHTML = ""; document.getElementById('result').insertBefore(span, null); }; })(file); // Read in the image file as a data URL. reader.readAsDataURL(file); //$('#cropbox').Jcrop(options, function () { jcrop_api = this; }); } else { alert("the file you entered is not a picture"); $("#profile_pic_form").each(function() { this.reset(); }); } } $(document).ready(function() { // Check for the various File API support. if (window.File &amp;&amp; window.FileReader &amp;&amp; window.FileList &amp;&amp; window.Blob) { document.getElementById('file').addEventListener('change', handleFileSelect, false); } else { alert('The File APIs are not fully supported in this browser.'); } }); </code></pre> <p></p> <p>The js gets the file and generate the span &amp; img tag inside the output tag.</p> <p>What I want now is to "Jcrop" the picture BUT when I try <em>$("#cropbox).Jcrop();</em> nothing happens, why ? </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.
 

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