Ir para conteúdo

POWERED BY:

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Williams Duarte

Pegar o crop e enviar para servidor

Recommended Posts

Olá galera,

 

Não é meu forte javascript, porem estou horas tentando entender este código, ele gera uma imagem para recortar sem upload para o servidor, muito top por sinal, até ai ele é diferente dos que conheço.

 

O meu problema é que não consigo pegar o name ou sei lá o que que ele gera e enviar para o servidor para fazer upload do crop.

 

vou postar aqui todo o código que tenho e se alguém consegue fazer este script enviar a imagem para o servidor eu agradeço, e se conseguir fique a vontade para usa-lo também!! :kiss:

 

desde já agradeço

 

index.html

<!DOCTYPE html><html lang="en"><head>	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">	<meta charset="utf-8">	<title>jQuery & Canvas Image Cropper</title>	<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0">	<link rel="icon" href="data:,">	<link rel="stylesheet" type="text/css" href="example.css">	<link rel="stylesheet" type="text/css" href="crop.css">	<script src="//ajax.googleapis.com/ajax/libs/jquery/2.0.2/jquery.min.js"></script>	<script src="crop.min.js"></script></head><body style="">	<input type="file" class="uploadfile" id="uploadfile">	<div class="newupload">Upload an image?</div>	<div class="example">		<!--			NOTE: To change the aspect ratio, look in crop.css			The class 'default' links the div to the innit(); function		-->		<div class="default">			<div class="cropMain"></div>			<div class="cropSlider"></div>			<button class="cropButton">Crop</button>		</div>	</div>	<article>		<header>			<h1>jQuery & Canvas <em>Image Crop</em> <span class="version">v2</span></h1>			<p>A cropper for when you need images to be a specific size. It works using a predetermined aspect ratio. The UI differs from other croppers, here you may drag the image into position and even resize it.</p>		</header>		<section>			<h2>Touchescreen Compatible!</h2>			<ul>				<li>Works in all the major browsers, including IE8+ and mobile.</li>				<li>Cropping and resizing is done through Canvas. No backend scripting required.</li>				<li>Minimal code. Doesn't require jQuery UI.</li>				<li>The UI differs drastically from traditional image croppers.</li>				<li>Idiot-proof. I've added precautions to insure the computer  illiterate don't break it. For example, if the image proporations do not scale to the predetermined aspect ratio, then the image will automatically zoom in until it does scale.</li>				<li>Aspect ratio is easily changable through CSS. You haven't got to touch any JavaScript.</li>				<li>Custom styles. The code is barebones, it's very easy to style.</li>			</ul>		</section>	</article><script>function loadImageFile() {    if (document.getElementById("uploadfile").files.length === 0) return;    var e = document.getElementById("uploadfile").files[0];    if (!rFilter.test(e.type)) {        return    }    oFReader.readAsDataURL(e)}var one = new CROP;one.init(".default");one.loadImg("example.jpg");$("body").on("click", "button", function () {    $("canvas").remove();    $(".default").after('<canvas width="240" height="240" id="canvas"/>');    var e = document.getElementById("canvas").getContext("2d"),        t = new Image,        n = coordinates(one).w,        r = coordinates(one).h,        i = coordinates(one).x,        s = coordinates(one).y,        o = 240,        u = 240;				//window.alert(one);				$.ajax({			type:"GET",			url:"ajax_image.php?t=ajax&img="+e+"&w="+n+"&h="+r+"&x1="+i+"&y1="+s+"&o="+o+"&u="+u,			cache:false,			success:function(rsponse)			{				//			}		});		    t.src = coordinates(one).image;    t.onload = function () {        e.drawImage(t, i, s, n, r, 0, 0, o, u);        $("canvas").addClass("output").show().delay("4000").fadeOut("slow")    }	});$("body").on("click", ".newupload", function () {    $(".uploadfile").click()});$("body").change(".uploadfile", function () {    loadImageFile();    $(".uploadfile").wrap("<form>").closest("form").get(0).reset();    $(".uploadfile").unwrap()});oFReader = new FileReader, rFilter = /^(?:image\/bmp|image\/cis\-cod|image\/gif|image\/ief|image\/jpeg|image\/jpeg|image\/jpeg|image\/pipeg|image\/png|image\/svg\+xml|image\/tiff|image\/x\-cmu\-raster|image\/x\-cmx|image\/x\-icon|image\/x\-portable\-anymap|image\/x\-portable\-bitmap|image\/x\-portable\-graymap|image\/x\-portable\-pixmap|image\/x\-rgb|image\/x\-xbitmap|image\/x\-xpixmap|image\/x\-xwindowdump)$/i;oFReader.onload = function (e) {    $(".example").html('<div class="default"><div class="cropMain"></div><div class="cropSlider"></div><button class="cropButton">Crop</button></div>');    one = new CROP;    one.init(".default");    one.loadImg(e.target.result)}</script></body></html>

ajax_image.php

<?php$t_width = 90;	// Maximum thumbnail width$t_height = 128;	// Maximum thumbnail height$new_name = "small.jpg"; // Thumbnail image name$path = "uploads/";if(isset($_GET['t']) and $_GET['t'] == "ajax"){	extract($_GET);	$ratio = ($t_width/$w); 	$nw = ceil($w * $ratio);	$nh = ceil($h * $ratio);	$nimg = imagecreatetruecolor($nw,$nh);	$im_src = imagecreatefromjpeg($path.$img);	imagecopyresampled($nimg,$im_src,0,0,$x1,$y1,$nw,$nh,$w,$h);	imagejpeg($nimg,$path.$new_name,90);	}

crop.min.js

 

 

var CROP=function(){return function(){this.eles={ele:undefined,container:undefined,img:undefined,overlay:undefined};this.img=undefined;this.imgInfo={aw:0,ah:0,w:0,h:0,at:0,al:0,t:0,l:0,s:1};this.init=function(e){this.settings={slider:e+" .cropSlider"};var e=$(e+" .cropMain"),t,n,r,i=this;n=$("<div />").attr({"class":"crop-container"}).css({width:e.width(),height:e.height()});t=$("<img />").attr({"class":"crop-img"}).css({zIndex:5999,top:0,left:0});r=$("<div />").attr({"class":"crop-overlay"}).css({zIndex:6e3});n.append®;n.append(t);e.append(n);this.eles.ele=e;this.eles.container=n;this.eles.img=t;this.eles.overlay=r;n.resize(function(){i.imgSize()});r.bind(document.ontouchstart!==null?"mousedown":"touchstart",function(e){var t=$(this),n={x:e.pageX||e.originalEvent.pageX,y:e.pageY||e.originalEvent.pageY},s={x:t.parent().offset().left,y:t.parent().offset().top};e.preventDefault();$(document).bind(document.ontouchmove!==null?"mousemove":"touchmove",function(e){if(e.pageX||typeof e.originalEvent.changedTouches[0]!==undefined){var r={x:e.pageX||e.originalEvent.changedTouches[0].pageX,y:e.pageY||e.originalEvent.changedTouches[0].pageY};if(parseInt(t.css("top"))==0){t.css({top:i.eles.ele.offset().top,left:i.eles.ele.offset().left})}i.imgMove({t:parseInt(t.css("top"))-(s.y-(n.y-r.y)),l:parseInt(t.css("left"))-(s.x-(n.x-r.x))});t.css({left:s.x-(n.x-r.x),top:s.y-(n.y-r.y)})}});$(document).bind(document.ontouchend!==null?"mouseup":"touchend",function(e){$(document).unbind(document.ontouchmove!==null?"mousemove":"touchmove");r.css({top:0,left:0})});return false});this.slider()};this.loadImg=function(e){var t=this;this.eles.img.attr("src",e).load(function(){t.imgSize()})};this.imgSize=function(){var e=this.eles.img,t={w:e.css("width","").width(),h:e.css("height","").height()},n=this.eles.container;var r={wh:this.eles.container.width()/this.eles.container.height(),hw:this.eles.container.height()/this.eles.container.width()};this.imgInfo.aw=t.w;this.imgInfo.ah=t.h;if(t.w*r.hw<t.h*r.wh){this.imgInfo.w=n.width()-40*2;this.imgInfo.h=this.imgInfo.w*(t.h/t.w);this.imgInfo.al=40}else{this.imgInfo.h=n.height()-40*2;this.imgInfo.w=this.imgInfo.h*(t.w/t.h);this.imgInfo.at=40}this.imgResize()};this.imgResize=function(e){var t=this.eles.img,n=this.imgInfo,r=n.s;n.s=e||n.s;t.css({width:n.w*n.s,height:n.h*n.s});this.imgMove({t:-(n.h*r-n.h*n.s)/2,l:-(n.w*r-n.w*n.s)/2})};this.imgMove=function(e){var t=this.eles.img,n=this.imgInfo,r=this.eles.container;n.t+=e.t;n.l+=e.l;var i=n.at-n.t,s=n.al-n.l;if(i>40){i=40;n.t=n.at==40?0:-40}else if(i<-(n.h*n.s-(r.height()-40))){i=-(n.h*n.s-(r.height()-40));n.t=n.at==40?n.h*n.s-(r.height()-80):n.h*n.s-(r.height()-40)}if(s>40){s=40;n.l=n.al==40?0:-40}else if(s<-(n.w*n.s-(r.width()-40))){s=-(n.w*n.s-(r.width()-40));n.l=n.al==40?n.w*n.s-(r.width()-80):n.w*n.s-(r.width()-40)}t.css({top:i,left:s})};this.slider=function(){var e=this;$(this.settings.slider).noUiSlider({range:[1,4],start:1,step:.002,handles:1,slide:function(){var t=$(this).val();e.imgResize(t)}})};coordinates=function e(t){var n=t.imgInfo,r=t.eles.container,i=t.eles.img,s=i.attr("src"),e={x:-(parseInt(i.css("left"))-40)*(n.aw/(n.w*n.s)),y:-(parseInt(i.css("top"))-40)*(n.ah/(n.h*n.s)),w:(r.width()-40*2)*(n.aw/(n.w*n.s)),h:(r.height()-40*2)*(n.ah/(n.h*n.s)),image:s};return e}}}();(function(e,t){if(e.zepto&&!e.fn.removeData)throw new ReferenceError("Zepto is loaded without the data module.");e.fn.noUiSlider=function(n){function r(t,n,r){e.isArray(t)||(t=[t]);e.each(t,function(e,t){"function"===typeof t&&t.call(n,r)})}function i(t){return t instanceof e||e.zepto&&e.zepto.isZ(t)}function s(n){n.preventDefault();var r=0===n.type.indexOf("touch"),i=0===n.type.indexOf("mouse"),s=0===n.type.indexOf("pointer"),o,u,a=n;0===n.type.indexOf("MSPointer")&&(s=!0);n.originalEvent&&(n=n.originalEvent);r&&(o=n.changedTouches[0].pageX,u=n.changedTouches[0].pageY);if(i||s)s||window.pageXOffset!==t||(window.pageXOffset=document.documentElement.scrollLeft,window.pageYOffset=document.documentElement.scrollTop),o=n.clientX+window.pageXOffset,u=n.clientY+window.pageYOffset;return e.extend(a,{x:o,y:u})}function o(t,n,r,i,o){t=t.replace(/\s/g,E+" ")+E;if(o)return 1<o&&(i=e.extend(n,i)),n.on(t,e.proxy(r,i));i.handler=r;return n.on(t,e.proxy(function(e){if(this.target.is('[class*=noUi-state-], [disabled]'))return!1;this.handler(s(e))},i))}function u(e){return!isNaN(parseFloat(e))&&isFinite(e)}function a(e){return parseFloat(this.style[e])}function f(t,n){function r(e){return i(e)||"string"===typeof e||!1===e}var s={handles:{r:!0,t:function(e){e=parseInt(e,10);return 1===e||2===e}},range:{r:!0,t:function(e,t,n){if(2!==e.length)return!1;e=[parseFloat(e[0]),parseFloat(e[1])];if(!u(e[0])||!u(e[1])||"range"===n&&e[0]===e[1]||e[1]<e[0])return!1;t[n]=e;return!0}},start:{r:!0,t:function(t,n,r){return 1===n.handles?(e.isArray(t)&&(t=t[0]),t=parseFloat(t),n.start=[t],u(t)):this.parent.range.t(t,n,r)}},connect:{t:function(e,t){return!0===e||!1===e||"lower"===e&&1===t.handles||"upper"===e&&1===t.handles}},orientation:{t:function(e){return"horizontal"===e||"vertical"===e}},margin:{r:!0,t:function(e,t,n){e=parseFloat(e);t[n]=e;return u(e)}},serialization:{r:!0,t:function(t,n){if(t.resolution)switch(t.resolution){case 1:case.1:case.01:case.001:case 1e-4:case 1e-5:break;default:return!1}else n.serialization.resolution=.01;if(t.mark)return"."===t.mark||","===t.mark;n.serialization.mark=".";return t.to?1===n.handles?(e.isArray(t.to)||(t.to=[t.to]),n.serialization.to=t.to,r(t.to[0])):2===t.to.length&&r(t.to[0])&&r(t.to[1]):!1}},slide:{t:function(e){return"function"===typeof e}},set:{t:function(e,t){return this.parent.slide.t(e,t)}},step:{t:function(e,t,n){return this.parent.margin.t(e,t,n)}},init:function(){var t=this;e.each(t,function(e,n){n.parent=t});delete this.init;return this}}.init();e.each(s,function(e,r){if(r.r&&!t[e]&&0!==t[e]||(t[e]||0===t[e])&&!r.t(t[e],t,e))throw console&&console.log&&console.group&&(console.group("Invalid noUiSlider initialisation:"),console.log("Option: ",e),console.log("Value: ",t[e]),console.log("Slider: ",n[0]),console.groupEnd()),new RangeError("noUiSlider")})}function l(e,t){e=e.toFixed(t.data("decimals"));return e.replace(".",t.data("mark"))}function c(e,t,n){var r=e.data("nui").options,i=e.data("nui").base.data("handles"),s=e.data("nui").style;if(!u(t)||t===e[0].gPct(s))return!1;t=0>t?0:100<t?100:t;if(r.step&&!n){var o=A.from(r.range,r.step);t=Math.round(t/o)*o}if(t===e[0].gPct(s)||e.siblings("."+N[1]).length&&!n&&i&&(e.data("nui").number?(n=i[0][0].gPct(s)+r.margin,t=t<n?n:t):(n=i[1][0].gPct(s)-r.margin,t=t>n?n:t),t===e[0].gPct(s)))return!1;0===e.data("nui").number&&95<t?e.addClass(N[13]):e.removeClass(N[13]);e.css(s,t+"%");e.data("store").val(l(A.is(r.range,t),e.data("nui").target));return!0}function h(n,r){var s=n.data("nui").number,u={target:n.data("nui").target,options:n.data("nui").options,handle:n,i:s};if(i(r.to))return o("change blur",r.to,O[0],u,2),o("change",r.to,u.options.set,u.target,1),r.to;if("string"===typeof r.to)return e('<input type="hidden" name="'+r.to+'">').appendTo(n).addClass(N[3]).change(O[1]);if(!1===r.to)return{val:function(e){if(e===t)return this.handleElement.data("nui-val");this.handleElement.data("nui-val",e)},hasClass:function(){return!1},handleElement:n}}function d(e){var t=this.base,n=t.data("style"),i=e.x-this.startEvent.x,s="left"===n?t.width():t.height();"top"===n&&(i=e.y-this.startEvent.y);i=this.position+100*i/s;c(this.handle,i);r(t.data("options").slide,t.data("target"))}function v(){var t=this.base,n=this.handle;n.children().removeClass(N[4]);S.off(x.move);S.off(x.end);e("body").off(E);t.data("target").change();r(n.data("nui").options.set,t.data("target"))}function m(t){var n=this.handle,r=n[0].gPct(n.data("nui").style);n.children().addClass(N[4]);o(x.move,S,d,{startEvent:t,position:r,base:this.base,target:this.target,handle:n});o(x.end,S,v,{base:this.base,target:this.target,handle:n});e("body").on("selectstart"+E,function(){return!1})}function g(e){e.stopPropagation();v.call(this)}function y(e){if(!this.base.find("."+N[4]).length){var t,n,i=this.base;n=this.handles;var s=i.data("style");e=e["left"===s?"x":"y"];var o="left"===s?i.width():i.height(),u=[],a={left:i.offset().left,top:i.offset().top};for(t=0;t<n.length;t++)u.push({left:n[t].offset().left,top:n[t].offset().top});t=1===n.length?0:(u[0]+u[1])/2;n=1===n.length||e<t?n[0]:n[1];i.addClass(N[5]);setTimeout(function(){i.removeClass(N[5])},300);c(n,100*(e-a)/o);r([n.data("nui").options.slide,n.data("nui").options.set],i.data("target"));i.data("target").change()}}function b(){var t=[];e.each(e(this).data("handles"),function(e,n){t.push(n.data("store").val())});return 1===t.length?t[0]:t}function w(n,i){if(n===t)return b.call(this);i=!0===i?{trigger:!0}:i||{};e.isArray(n)||(n=[n]);return this.each(function(s,o){o=e(o);e.each(e(this).data("handles"),function(s,u){if(null!==n&&n!==t){var a,f;f=u.data("nui").options.range;a=n;i.trusted=!0;if(!1===i.trusted||1===n.length)i.trusted=!1;2===n.length&&0<=e.inArray(null,n)&&(i.trusted=!1);"string"===e.type(a)&&(a=a.replace(",","."));a=A.to(f,parseFloat(a));a=c(u,a,i.trusted);i.trigger&&r(u.data("nui").options.set,o);a||(a=u.data("store").val(),f=A.is(f,u[0].gPct(u.data("nui").style)),a!==f&&u.data("store").val(l(f,o)))}})})}var E=".nui",S=e(document),x={start:"mousedown touchstart",move:"mousemove touchmove",end:"mouseup touchend"},T=e.fn.val,N="noUi-base noUi-origin noUi-handle noUi-input noUi-active noUi-state-tap noUi-target -lower -upper noUi-connect noUi-vertical noUi-horizontal noUi-background noUi-z-index".split(" "),C=[N[0]],k=[N[1]],L=[N[2]],A={to:function(e,t){t=0>e[0]?t+Math.abs(e[0]):t-e[0];return 100*t/this.len(e)},from:function(e,t){return 100*t/this.len(e)},is:function(e,t){return t*this.len(e)/100+e[0]},len:function(e){return e[0]>e[1]?e[0]-e[1]:e[1]-e[0]}},O=[function(){this.target.val([this.i?null:this.val(),this.i?this.val():null],{trusted:!1})},function(e){e.stopPropagation()}];window.navigator.pointerEnabled?x={start:"pointerdown",move:"pointermove",end:"pointerup"}:window.navigator.msPointerEnabled&&(x={start:"MSPointerDown",move:"MSPointerMove",end:"MSPointerUp"});e.fn.val=function(){return this.hasClass(N[6])?w.apply(this,arguments):T.apply(this,arguments)};return function(t){return this.each(function(n,r){r=e®;r.addClass(N[6]);var i,s,u,l,p=e("<div/>").appendTo®,d=[],v=[k.concat([N[1]+N[7]]),k.concat([N[1]+N[8]])],b=[L.concat([N[2]+N[7]]),L.concat([N[2]+N[8]])];t=e.extend({handles:2,margin:0,orientation:"horizontal"},t)||{};t.serialization||(t.serialization={to:[!1,!1],resolution:.01,mark:"."});f(t,r);t.S=t.serialization;t.connect?"lower"===t.connect?(C.push(N[9],N[9]+N[7]),v[0].push(N[12])):(C.push(N[9]+N[8],N[12]),v[0].push(N[9])):C.push(N[12]);s="vertical"===t.orientation?"top":"left";u=t.S.resolution.toString().split(".");u="1"===u[0]?0:u[1].length;"vertical"===t.orientation?C.push(N[10]):C.push(N[11]);p.addClass(C.join(" ")).data("target",r);r.data({base:p,mark:t.S.mark,decimals:u});for(i=0;i<t.handles;i++)l=e("<div><div/></div>").appendTo(p),l.addClass(v.join(" ")),l.children().addClass(b.join(" ")),o(x.start,l.children(),m,{base:p,target:r,handle:l}),o(x.end,l.children(),g,{base:p,target:r,handle:l}),l.data("nui",{target:r,decimals:u,options:t,base:p,style:s,number:i}).data("store",h(l,t.S)),l[0].gPct=a,d.push(l),c(l,A.to(t.range,t.start));p.data({options:t,handles:d,style:s});r.data({handles:d});o(x.end,p,y,{base:p,target:r,handles:d})})}.call(this,n)}})($)

 

 

crop.css

 

 

 

/*---------------------------------------------------------*/

/*

/* set the aspect ratio

/*

/* the cropper has a 40px offset

/* this means 80px will be subtracted from the image height and width

/*

/* the class .one must match the class written into one.init('.one');

/*

/*---------------------------------------------------------*/

 

.default .cropMain {

width:320px;

height:320px;

}

 

 

/*---------------------------------------------------------*/

/* cropper styling begins here...

/*---------------------------------------------------------*/

 

.cropMain {

background:url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAAHnlligAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAHJJREFUeNpi+P///5EjRxiAGMgCCCAGFB5AADGCRBgYjh49CiRZIJS1tTWQBAggFBkmBiSAogxFBiCAoHogAKIKAlBUYTELAiAmEtABEECk20G6BOmuIl0CIMBQ/IEMkO0myiSSraaaBhZcbkUOs0HuBwARxT7aD6kRXAAAAABJRU5ErkJggg==') repeat;

-webkit-box-shadow: inset 0 0 6px rgba(0, 0, 0, 0.5);

box-shadow:inset 0 0 6px rgba(0, 0, 0, 0.5);

}

 

.cropMain .crop-img { position: absolute }

 

.cropMain .crop-container {

overflow: hidden;

position: relative;

}

 

.cropMain .crop-container:after {

content: "";

position: absolute;

top: 0;

left: 0;

width: 100%;

height: 100%;

z-index: 5999;

opacity: .75;

filter: alpha(opacity=7);

-webkit-box-shadow: inset 0 0 0 40px white,inset 0 0 0 41px rgba(0,0,0,.1),inset 0 0 20px 41px rgba(0,0,0,.2);

box-shadow: inset 0 0 0 40px white,inset 0 0 0 41px rgba(0,0,0,.1),inset 0 0 20px 41px rgba(0,0,0,.2);

}

 

.cropMain .crop-overlay {

position: relative;

cursor: move;

top: 0;

left: 0;

width: 100%;

height: 100%;

}

 

 

/*---------------------------------------------------------*/

/* slider bar styling

/*---------------------------------------------------------*/

 

.cropSlider .noUi-target * {

-webkit-box-sizing:border-box;

-moz-box-sizing:border-box;

box-sizing:border-box;

-webkit-touch-callout:none;

-ms-touch-action:none;

-webkit-user-select:none;

-moz-user-select:none;

-ms-user-select:none;

cursor:default

}

.cropSlider .noUi-base {

margin: 25px 10px;

height: 7px;

border-radius: 4px;

background-color: #bbb;

cursor:pointer;

position:relative;

z-index:1

}

.cropSlider .noUi-handle {

width: 16px;

height: 16px;

background: #fff;

box-shadow: 0 1px 3px rgba(0,0,0,0.4), inset 0 -4px 8px rgba(0,0,0,0.10);

cursor: move;

border-radius: 4px;

margin:-5px 0 0 -8px

}

.cropSlider .noUi-active {

 

}

.cropSlider .noUi-connect {

background:Teal

}

.cropSlider .noUi-background {

background:#bbb

}

.cropSlider .noUi-origin-lower {

background:#eee;

}

.cropSlider .noUi-origin {

position:absolute;

right:0;

top:0;

bottom:0;

z-index:0;

border-radius:inherit

}

.cropSlider .noUi-origin-upper {

background:inherit!important

}

.cropSlider .noUi-z-index {

z-index:10

}

.cropSlider .noUi-vertical {

width:40px;

height:100%

}

.cropSlider .noUi-vertical .noUi-origin {

bottom:0;

left:0

}

.cropSlider .noUi-vertical .noUi-handle {

margin:-23px 0 0 -3px

}

.cropSlider .noUi-target[disabled] .noUi-base {

background: #ccc;

box-shadow: none;

}

.cropSlider .noUi-target[disabled] .noUi-connect {

background: #ccc;

box-shadow: none;

}

.cropSlider .noUi-state-tap .noUi-origin {

-webkit-transition:left .3s, top .3s;

transition:left .3s, top .3s

}

 

 

/*---------------------------------------------------------*/

/* crop button styling

/*---------------------------------------------------------*/

 

.cropButton {

background-color: #fff;

background-image: -webkit-linear-gradient(top, #fff 0, #e6e6e6 100%);

background-image: -moz-linear-gradient(top, #fff 0, #e6e6e6 100%);

background-image: -ms-linear-gradient(top, #fff 0, #e6e6e6 100%);

background-image: -o-linear-gradient(top, #fff 0, #e6e6e6 100%);

background-image: linear-gradient(top, #fff 0, #e6e6e6 100%);

border: 1px solid #d3d3d3;

color: #7c7c7c;

-moz-box-shadow: 0 1px 1px #b0afaf;

-o-box-shadow: 0 1px 1px #b0afaf;

-webkit-box-shadow: 0 1px 1px #b0afaf;

box-shadow: 0 1px 1px #b0afaf;

font-weight: normal;

font-size: 12px;

text-shadow: 1px 1px 1px #f5f5f5;

height: 25px;

width: auto;

padding: 0 15px;

cursor:pointer;

border-radius:5px;

}

 

.cropButton:hover {

color: #0b94c8;

background-color: #fff;

background-image: -webkit-linear-gradient(top, #fff 0, #f0eeee 100%);

background-image: -moz-linear-gradient(top, #fff 0, #f0eeee 100%);

background-image: -ms-linear-gradient(top, #fff 0, #f0eeee 100%);

background-image: -o-linear-gradient(top, #fff 0, #f0eeee 100%);

background-image: linear-gradient(top, #fff 0, #f0eeee 100%);

}

 

.cropButton:active {

-moz-box-shadow: inset 0 3px 5px #e6e6e6;

-o-box-shadow: inset 0 3px 5px #e6e6e6;

-webkit-box-shadow: inset 0 3px 5px #e6e6e6;

box-shadow: inset 0 3px 5px #e6e6e6;

}

 

 

 

example.css

 

 

 

@charset "UTF-8";

 

@font-face {

font-family: 'Cantora One';

font-style: normal;

font-weight: 400;

src: local('Cantora One'), local('CantoraOne-Regular'), url(http://themes.googleusercontent.com/static/fonts/cantoraone/v2/2Tarv7Qs4oCEU-xItQ7PXYbN6UDyHWBl620a-IRfuBk.woff) format('woff');

}

@font-face {

font-family: 'PT Serif';

font-style: normal;

font-weight: 400;

src: local('PT Serif'), local('PTSerif-Regular'), url(http://themes.googleusercontent.com/static/fonts/ptserif/v4/sDRi4fY9bOiJUbgq53yZCfesZW2xOQ-xsNqO47m55DA.woff) format('woff');

}

 

/*-----------------------------------------------------------------------------------*/

/* resets

/*-----------------------------------------------------------------------------------*/

 

html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{border:0;font-size:100%;font:inherit;vertical-align:baseline;text-decoration:none;font-weight:400;margin:0;padding:0}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}body{line-height:1}ol,ul{list-style:none}blockquote,q{quotes:none}blockquote:before,blockquote:after,q:before,q:after{content:none}table{border-collapse:collapse;border-spacing:0}*{outline:none;-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box;-webkit-font-smoothing:antialiased;font-smoothing:antialiased}button::-moz-focus-inner{border:0}

 

 

/*-----------------------------------------------------------------------------------*/

/* examples

/*-----------------------------------------------------------------------------------*/

 

.example {

padding:40px;

position:absolute;

text-align:center;

}

 

.example .default {

display:inline-block;

margin-right:25px;

z-index:99999;

position:absolute;

}

 

.output {

position:absolute;

z-index:55555;

top:80px;

left:400px;

box-shadow:0 0 0 100000px rgba(255,255,255,0.9);

}

 

.newupload {

border: 3px dashed rgba(0,0,0,0.04);

background: rgba(0,0,0,0.02);

width: 320px;

display: block;

margin-left:40px;

margin-top: 40px;

padding: 20px;

box-sizing:border-box;

text-align:center;

font-family:'PT Serif';

font-size: 18px;

color: rgba(0,0,0,0.5);

cursor:pointer;

}

.newupload:hover {

background: rgba(0,0,0,0.01);

}

 

#uploadfile { display:none }

 

 

/*-----------------------------------------------------------------------------------*/

/* main

/*-----------------------------------------------------------------------------------*/

 

body {

background: white;

font-size: 0;

font-family: 'PT Serif', serif;

}

 

h1, h2, h3, h4, h5, h6 {

font-family: 'Cantora One', sans-serif;

}

 

article a {

color:#2394c8;

border-bottom: 1px solid #eee;

}

article a:hover { color:#2cb6f7 }

 

article {

padding:40px;

display:block;

position:absolute;

top: 0;

left: 370px;

}

 

 

/*-----------------------------------------------------------------------------------*/

/* header

/*-----------------------------------------------------------------------------------*/

 

h1 { font-size:45px }

h1 em { color:#8aca4c }

 

.version{

font-size: 10px;

background: #ededed;

padding: 5px;

position: relative;

top: -15px;

left: 5px;

color:#888;

}

 

article header p {

margin: 15px 0;

font-size: 20px;

line-height: 30px;

color: #888;

}

 

article .details {

display: block;

margin-top: 20px;

font-size: 14px;

line-height: 16px;

color: #888;

}

 

article del { text-decoration:line-through }

 

 

/*-----------------------------------------------------------------------------------*/

/* sections

/*-----------------------------------------------------------------------------------*/

 

 

 

section {

padding-top:30px;

padding-bottom:30px;

}

 

section h2 {

font-size:32px;

padding-bottom:15px;

margin-bottom:20px;

border-bottom: 1px solid #eee;

}

 

section h3 {

font-size:20px;

line-height:26px;

margin:25px 0 15px 0;

}

 

section h4 {

font-size:16px;

line-height:20px;

margin:15px 0 5px 0;

}

 

section > p {

font-size: 16px;

line-height: 24px;

color: #4e4e4e;

margin-bottom:15px;

}

 

section > ul li {

list-style-type: square;

list-style-position: inside;

font-size: 16px;

line-height: 24px;

color: #757575;

}

 

section strong {

font-weight: bold;

}

section em {

font-style: italic;

}

section img {

margin: 10px 0;

}

 

 

 

.buy {

margin-top:10px;

-moz-border-radius: 4px;

-ms-border-radius: 4px;

-o-border-radius: 4px;

-webkit-border-radius: 4px;

border-radius: 4px;

-moz-transition: all 0.2s linear;

-o-transition: all 0.2s linear;

-webkit-transition: all 0.2s linear;

-ms-transition: all 0.2s linear;

transition: all 0.2s linear;

height: 40px;

width: 200px;

text-align: center;

color: #fff;

border: none;

font-size: 18px;

font-family:'PT Serif';

background-color: #ec5d59;

background-image: -webkit-linear-gradient(top, #ec5d59 0, #c33d36 100%);

background-image: -moz-linear-gradient(top, #ec5d59 0, #c33d36 100%);

background-image: -ms-linear-gradient(top, #ec5d59 0, #c33d36 100%);

background-image: -o-linear-gradient(top, #ec5d59 0, #c33d36 100%);

background-image: linear-gradient(top, #ec5d59 0, #c33d36 100%);

-moz-box-shadow: inset 0 2px 5px rgba(0,0,0,0.20), 0 3px 0 0 #94302a, 0 7px 5px rgba(0,0,0,0.10);

-o-box-shadow: inset 0 2px 5px rgba(0,0,0,0.20), 0 3px 0 0 #94302a, 0 7px 5px rgba(0,0,0,0.10);

-webkit-box-shadow: inset 0 2px 5px rgba(0,0,0,0.20), 0 3px 0 0 #94302a, 0 7px 5px rgba(0,0,0,0.10);

box-shadow: inset 0 2px 5px rgba(0,0,0,0.20), 0 3px 0 0 #94302a, 0 7px 5px rgba(0,0,0,0.10);

text-shadow: #94302a 0 1px 1px;

cursor:pointer;

padding:6px 10px;

}

 

.btn:hover {

-moz-box-shadow: inset 0 2px 5px rgba(0,0,0,0.20);

-o-box-shadow: inset 0 2px 5px rgba(0,0,0,0.20);

-webkit-box-shadow: inset 0 2px 5px rgba(0,0,0,0.20);

box-shadow: inset 0 2px 5px rgba(0,0,0,0.20);

color:white;

}

.btn:active {

-moz-box-shadow: none;

-o-box-shadow: none;

-webkit-box-shadow: none;

box-shadow: none;

text-shadow: none;

background: #202020;

}

 

/* syntax highlight

================================================== */

 

pre,

code {

font-family:'Droid Sans Mono', monospace;

padding:0;

font-size:12px;

line-height:14px;

white-space:pre-wrap;white-space:-moz-pre-wrap;white-space:-pre-wrap;white-space:-o-pre-wrap;word-wrap:break-word;

margin:15px 0 20px 0;

}

 

pre .nocode {background-color:none;color:#363636}

.str { color: #DD0000; }

.kwd { color: #007700; }

.com { color: #FF8000; font-style:italic; }

.typ { color: #0000BB; }

.lit { color: #0000BB; }

.pun { color: #007700; }

.pln { color: #0000BB; }

.tag { color: #008; }

.atn { color: #606; }

.atv { color: #080; }

.dec { color: #606; }

pre li{list-style-type:decimal;list-style-position:inside;color:#c1c1c1}

pre li:hover{background:#f8fbff}

 

 

 

 

up! ;)

Compartilhar este post


Link para o post
Compartilhar em outros sites

Envie a imagem em si, e não o name dela(pq isso é impossível).

Com o próprio FileReader que está ai vc consegue fazer isso. (depois do canvas gerar uma imagem válida para vc)

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.