Upload or paste part of the image,
and we'll show you the whole!

Click to upload an image


"; } function defaultStartupUrl(){ var data="http://static1.consumerreportscdn.org/cro/cdn-resources/images/book-store/products-by-type/magazines/bkstore_t_2011carpreview.jpg"; $('#url').val(data); pasteUrlBasedImage(); return false; } function setCaretPosition(ctrl, pos) { // Put the caret in the requested position. if(ctrl.setSelectionRange) { ctrl.focus(); ctrl.setSelectionRange(pos,pos); } else if (ctrl.createTextRange) { var range = ctrl.createTextRange(); range.collapse(true); range.moveEnd('character', pos); range.moveStart('character', pos); range.select(); } } // Paste a thumbnail image from web. function rescaleImage(image, scalefactor) { var destCanvas = document.createElement("canvas"); destCanvas.width = image.width * scalefactor; destCanvas.height = image.height * scalefactor; var destCtx = destCanvas.getContext("2d"); destCtx.drawImage(image, 0, 0, destCanvas.width, destCanvas.height); return destCanvas; } function asThumbnail( graphic ) { // If the source image is bogus, return it. if ( (graphic.width<=0) || (graphic.height<=0) ) return graphic; var maxSide = Math.max(graphic.width, graphic.height); var scale = 270.0 / maxSide ; var cc = graphic; if (maxSide > 270) { while (Math.max(cc.width,cc.height) > 540) { cc = rescaleImage(cc, 0.5); scale = scale*2; } } // Resize final version to size = 120. cc = rescaleImage( cc, scale); return cc; } function submitForm(searchTypeSelected) { // Display user feedback before upload process starts. var doc = window.parent.frames['search_results'].document; doc.getElementsByTagName("body")[0].innerHTML = "Uploading..."; // Upload the form data. var hiddenField = document.getElementById('searchType'); hiddenField.value= searchTypeSelected; $("#file_upload_form").submit(); } function pasteUrlBasedImage() { var destCanvas=document.getElementById("url_canvas"); var destCtx=destCanvas.getContext("2d"); var img = new Image; // First create the image... img.onload = function(){ // ...then set the onload handler... var thumbnail = asThumbnail(img); destCanvas.width = thumbnail.width; destCanvas.height= thumbnail.height; destCtx.fillStyle="white"; destCtx.fillRect(0,0,destCanvas.width, destCanvas.height); destCtx.drawImage(thumbnail,0,0); }; if ( $('#url').val() ) img.src = $('#url').val(); else img.src = ""; submitForm("1"); } function pasteDiskBasedImage() { var destCanvas=document.getElementById("url_canvas"); var destCtx=destCanvas.getContext("2d"); var img = new Image; // First create the image... img.onload = function(){ // ...then set the onload handler... var thumbnail = asThumbnail(img); destCanvas.width = thumbnail.width; destCanvas.height= thumbnail.height; destCtx.fillStyle="white"; destCtx.fillRect(0,0,destCanvas.width, destCanvas.height); destCtx.drawImage(thumbnail,0,0); }; if (fileInput) { if(window.FileReader) { // Safari <6 doesn't support FileReader. var reader = new FileReader(); reader.onloadend = function (e) { img.src = reader.result; } reader.readAsDataURL(fileInput); } } else { img.src = ""; } submitForm("0"); } function pasteCtrlVBasedImage() { var destCanvas=document.getElementById("url_canvas"); var destCtx=destCanvas.getContext("2d"); var img = new Image; // First create the image... img.onload = function(){ // ...then set the onload handler... var thumbnail = asThumbnail(img); destCanvas.width = thumbnail.width; destCanvas.height= thumbnail.height; destCtx.fillStyle="white"; destCtx.fillRect(0,0,destCanvas.width, destCanvas.height); destCtx.drawImage(thumbnail,0,0); } if ( (ctrlvImage != null) && (ctrlvImage.src != null)) img.src = ctrlvImage.src; else { img.src = ""; } pasteCatcher.html(''); submitForm("2"); } // Handle paste events function pasteHandler(event) { if ( isMozilla) { return true; } event.stopPropagation(); event.preventDefault(); event = event.originalEvent; // We need to check if event.clipboardData is supported (Chrome) or window.ClipboardData (IE). var cd = event.clipboardData; // For IE if ( !cd ) { cd = window.clipboardData; if (! cd ) return; // Nothing available. handleIEClipboardData(event, cd); } else { if ( ! cd.items ) handleIEClipboardData(event, cd); else handleClipboardData( cd ); } } function handleClipboardData( cd ) { // Get the items from the clipboard var items = cd.items; if (items) { if ( isDebugging ) alert("Items"); // Loop through all items, looking for any kind of image for (var i = 0; i < items.length; i++) { if ( isDebugging ) alert(items[i].type); if (items[i].type.indexOf("image") !== -1) { if ( isDebugging ) alert("Image"); // We need to represent the image as a file, var blob = items[i].getAsFile(); // and use a URL or webkitURL (whichever is available to the browser) // to create a temporary URL to the object var URLObj = window.URL || window.webkitURL; var source = URLObj.createObjectURL(blob); // The URL can then be used as the source of an image createImage(source); return; } } } } function handleIEClipboardData(event, cd ) { var blobList = []; // Store the pasted content in a variable var fileList = cd.files; // Note that window.DataTransfer.files is not applicable. if (!fileList) { console.log("fileList is null."); return; } for (var i = 0; i < fileList.length; i++) { var file = fileList[i]; var url = URL.createObjectURL(file); if (event.convertURL) { // Use standard if available. event.convertURL(file, "specified", url); } else { event.msConvertURL(file, "specified", url); } console.log("Local file: " + file.name + " (" + file.size + ")"); blobList.push(file); } // for if (blobList.length > 0) { // We need to represent the image as a file, var blob = blobList[0]; //.getAsFile(); // and use a URL or webkitURL (whichever is available to the browser) // to create a temporary URL to the object var URLObj = window.URL || window.webkitURL; var source = URLObj.createObjectURL(blob); // The URL can then be used as the source of an image createImage(source); } pasteCatcher.html(''); return; } function pasteHandlerMozilla(event) { if ( isMozilla) { setTimeout(checkInput, 100); } return false; } function checkInput() { // Store the pasted content in a variable. var nodes = document.getElementById("pasteCatcher").childNodes; var n = nodes.length; for (i=0; i