{"action":"created","issue":{"url":"https://api.github.com/repos/scottcheng/cropit/issues/152","repository_url":"https://api.github.com/repos/scottcheng/cropit","labels_url":"https://api.github.com/repos/scottcheng/cropit/issues/152/labels{/name}","comments_url":"https://api.github.com/repos/scottcheng/cropit/issues/152/comments","events_url":"https://api.github.com/repos/scottcheng/cropit/issues/152/events","html_url":"https://github.com/scottcheng/cropit/issues/152","id":125451272,"number":152,"title":"After removing background image with a \"delete\" button, I can't get a new image to load","user":{"login":"deronsizemore","id":68437,"avatar_url":"https://avatars.githubusercontent.com/u/68437?v=3","gravatar_id":"","url":"https://api.github.com/users/deronsizemore","html_url":"https://github.com/deronsizemore","followers_url":"https://api.github.com/users/deronsizemore/followers","following_url":"https://api.github.com/users/deronsizemore/following{/other_user}","gists_url":"https://api.github.com/users/deronsizemore/gists{/gist_id}","starred_url":"https://api.github.com/users/deronsizemore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deronsizemore/subscriptions","organizations_url":"https://api.github.com/users/deronsizemore/orgs","repos_url":"https://api.github.com/users/deronsizemore/repos","events_url":"https://api.github.com/users/deronsizemore/events{/privacy}","received_events_url":"https://api.github.com/users/deronsizemore/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2016-01-07T17:55:43Z","updated_at":"2016-03-08T17:19:21Z","closed_at":null,"body":"I found this post: https://github.com/scottcheng/cropit/issues/146 and followed it and got it working to where I can load an image into the cropit area and then click my \"cancel\" button to remove the image. The problem then becomes that when I click on the browse button again and click on an image, it does not load it into the cropit image area until I first refresh the page. Can anyone point me in the right direction as to how I can reinitialize the upload feature once my \"cancel\" button is clicked? Here's my code:\r\n\r\n\t<div id=\"image-cropper\">\r\n\t\t<!-- And clicking on this button will open up select file dialog -->\r\n\t\t<div class=\"select-image-btn\">Select new image</div>\r\n\t\t<a href=\"\" class=\"image-cropper-cancel\">Cancel</a>\r\n\t\t<div class=\"cropit-image-preview\"><span class=\"preview-info\">Your image will appear here where it can be moved accross to suit where you want to crop it.</span></div>\r\n\r\n\t\t<!-- <input type=\"range\" class=\"cropit-image-zoom-input\" /> -->\r\n\r\n\t\t<!-- The actual file input will be hidden -->\r\n\t\t<input type=\"file\" class=\"cropit-image-input\" />\r\n\t</div>\r\n\r\n\t<script>\r\n\t$(function() {\r\n\t\t$('#image-cropper').cropit({\r\n\t\t\tinitialZoom: 'image',\r\n\t\t\tonImageLoaded: function() {\r\n\t\t\t\t$('.preview-info').hide();\r\n\t\t\t},\r\n\t\t\tonImageError: function(object) {\r\n\t\t\t\tconsole.log(object.message);\r\n\t\t\t}\r\n\t\t});\r\n\r\n\t\t// When user clicks select image button,\r\n\t\t// open select file dialog programmatically\r\n\t\t$('.select-image-btn').click(function() {\r\n\t\t  $('.cropit-image-input').click();\r\n\t\t});\r\n\r\n\t\t$('.image-cropper-cancel').click(function(event){\r\n\t\t\tevent.preventDefault();\r\n\t\t\tif($('.cropit-image-preview').hasClass('cropit-image-loaded')){\r\n\t\t\t\t$('.cropit-image-preview').css('background-image', ''); //remove preview-images\r\n\t\t\t\t$('.cropit-image-preview').removeClass('cropit-image-loaded').removeAttr('style');\r\n\t\t\t\t$('.preview-info').show();\r\n\t\t\t}\r\n\t\t});\r\n\t});\r\n\t</script>"},"comment":{"url":"https://api.github.com/repos/scottcheng/cropit/issues/comments/193875778","html_url":"https://github.com/scottcheng/cropit/issues/152#issuecomment-193875778","issue_url":"https://api.github.com/repos/scottcheng/cropit/issues/152","id":193875778,"user":{"login":"deronsizemore","id":68437,"avatar_url":"https://avatars.githubusercontent.com/u/68437?v=3","gravatar_id":"","url":"https://api.github.com/users/deronsizemore","html_url":"https://github.com/deronsizemore","followers_url":"https://api.github.com/users/deronsizemore/followers","following_url":"https://api.github.com/users/deronsizemore/following{/other_user}","gists_url":"https://api.github.com/users/deronsizemore/gists{/gist_id}","starred_url":"https://api.github.com/users/deronsizemore/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/deronsizemore/subscriptions","organizations_url":"https://api.github.com/users/deronsizemore/orgs","repos_url":"https://api.github.com/users/deronsizemore/repos","events_url":"https://api.github.com/users/deronsizemore/events{/privacy}","received_events_url":"https://api.github.com/users/deronsizemore/received_events","type":"User","site_admin":false},"created_at":"2016-03-08T17:19:21Z","updated_at":"2016-03-08T17:19:21Z","body":"Oh, that's right. I remember that now from when I first started looking at this way back when. It gives you the base64 data of that image, doesn't it? I'm using Python on the backend with the Django framework and if I remember I was struggling to process a base64 data. I'll have to revisit it."}}