sconsult / croppic

croppic
914 stars 228 forks source link

black border after crop #260

Open blue-eyed-devil opened 7 years ago

blue-eyed-devil commented 7 years ago

when picture moved on the edge and cropped, it adds 1px thick black border on the edge (same even in example files from zip package). I found the way how to fix it. This: if (parseInt(that.img.css('top')) > 0) { that.img.css('top', 0); if (that.options.imgEyecandy) { that.imgEyecandy.css('top', 0);}} var maxTop = -( that.imgH - that.objH); if (parseInt(that.img.css('top')) < maxTop) { that.img.css('top', maxTop); if (that.options.imgEyecandy) { that.imgEyecandy.css('top', maxTop); }}

Must be changed to: if (parseInt(that.img.css('top')) > 0) { that.img.css('top', 1); if (that.options.imgEyecandy) { that.imgEyecandy.css('top', 1);}} var maxTop = -( that.imgH - that.objH); if (parseInt(that.img.css('top')) < maxTop) { that.img.css('top', maxTop+2); if (that.options.imgEyecandy) { that.imgEyecandy.css('top', maxTop+2); }}

And this: if( parseInt( that.img.css('left')) > 0 ){ that.img.css('left',0); if(that.options.imgEyecandy){ that.imgEyecandy.css('left', 0); }} var maxLeft = -( that.imgW-that.objW); if( parseInt( that.img.css('left')) < maxLeft){ that.img.css('left', maxLeft); if(that.options.imgEyecandy){ that.imgEyecandy.css('left', maxLeft); } }

Must be changed to: if( parseInt( that.img.css('left')) > 0 ){ that.img.css('left',1); if(that.options.imgEyecandy){ that.imgEyecandy.css('left', 1); }} var maxLeft = -( that.imgW-that.objW); if( parseInt( that.img.css('left')) < maxLeft){ that.img.css('left', maxLeft+2); if(that.options.imgEyecandy){ that.imgEyecandy.css('left', maxLeft+2); } }

Master-Y0da commented 7 years ago

Not working....still getting the black line after cropp an image =(

blue-eyed-devil commented 7 years ago

try this one: https://github.com/blue-eyed-devil/croppic and clear cache before you test so browser will get new version of js file

Jafo232 commented 7 years ago

I had this same issue and could only resolve it by applying the forked version.

tuptuptup commented 4 years ago

It should be var cropData = { imgUrl:that.imgUrl, imgInitW:that.imgInitW, imgInitH:that.imgInitH, imgW:that.imgW+3, imgH:that.imgH+3, imgY1:Math.abs(parseInt(that.img.css('top'))-1), imgX1:Math.abs(parseInt(that.img.css('left'))-1), cropH:that.objH, cropW:that.objW, rotation:that.actualRotation }; in croppic.js file.