html5 - I want to add current datetime for a image which is taken from camera API using phonegap -
i developing app ios/andorid/windows, have functionality capture image , save in our apps. images capturing , save folder , display in div. want add date time image taken. lets if take image on 25-08-2013. want display date time in image @ right corner.
how achieve in phonegap. heard canvas html5 feature dont know how use taken image in canvas tag.
function capturephoto() { navigator.camera.getpicture(onphotodatasuccess, onfail, { quality: 50, destinationtype: destinationtype.file_uri }); } function onfail(message) { alert('failed because: ' + message); } function onphotodatasuccess(imagedata) { console.log("image property-->"); var smallimage = document.getelementbyid('smallimage'); smallimage.style.display = 'block'; // smallimage.src = "data:image/jpeg;base64," + imagedata; smallimage.src = imagedata; } <div data-role="page"> <div data-role="header" data-theme="b"> <h1>date !t</h1> </div><!-- /header --> <div data-role="content"> <button onclick="capturephoto();">capture photo</button><br> <img style="display:none;width:60px;height:60px;" id="smallimage" src="" /> </div><!-- /content --> <div data-role="footer" data-position="fixed" data-theme="b"> <h4>footer</h4> </div><!-- /footer -->
you can using c# code
filestream fs = new filestream(@"c:\myimage.jpg", filemode.open, fileaccess.read);//or .jpg, etc... image image = image.fromstream(fs); fs.close(); bitmap b = new bitmap(image); graphics graphics = graphics.fromimage(b); var date = convert.tostring(datetime.now); graphics.drawstring(date, this.font, brushes.black, image.width - (date.length*5), 0); b.save(@"c:\myimage.jpg", image.rawformat); image.dispose(); b.dispose();
if dose not inform me search other method
Comments
Post a Comment