简体   繁体   English

将相机或图库中的图像保存在手机屏幕的画布中,然后旋转并裁剪

[英]Save image from camera or gallery in a canvas in phonegap and after rotate and crop it

Im novice in Phonegap, canvas, etc... and I have some problems with my project! 我是Phonegap,canvas等新手......我的项目有些问题!

1- I need to capture the picture from gallery or camera, it works fine and the image is saved in a . 1-我需要从图库或相机中捕获图片,它工作正常,图像保存在。 The problem is that I should save the image from the gallery or camera in a canvas because after take the picture I need to do rotation with the image. 问题是我应该将画廊或相机中的图像保存在画布中,因为在拍摄照片后我需要对图像进行旋转。

2- I tried to use kinetics.js to save the image in a canvas and with kinetics.js to do the rotation...but the problem is that my image is not available in the canvas in first time...you have to press "rotation button" and after you can see how the canvas is rotated with the image...I think that the problem is for the charge times with javascript, but I dont know how solve it. 2-我试图使用kinetics.js将图像保存在画布中并使用kinetics.js进行旋转......但问题是我的图像在第一次画布中不可用...你必须按“旋转按钮”,然后你可以看到画布如何与图像一起旋转......我认为问题是使用javascript充电时间,但我不知道如何解决它。

Some can help me, please?? 有些人可以帮帮我吗? More or less this is the description for my problem, I need to do rotation with the image that I recieved from the camera or gallery and after save it in the image because I need to call to Jcrop.js to crop the image!! 或多或少这是我的问题的描述,我需要旋转我从相机或画廊收到的图像和保存在图像后,因为我需要调用Jcrop.js裁剪图像!

Kind Regards! 亲切的问候!

I had an issue with the picture coming in sideways no matter what I took it with. 无论我把它放在哪里,我都有一个侧面出现问题的问题。 I fixed this rotation issue with the following code: 我用以下代码修复了这个轮换问题:

navigator.camera.getPicture(onPhotoDataSuccess, onFail, { quality: 50, destinationType: destinationType.DATA_URL, correctOrientation: true }); navigator.camera.getPicture(onPhotoDataSuccess,onFail,{quality:50,destinationType:destinationType.DATA_URL,correctOrientation:true});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM