android - uploading high quality image on parse.com -
whenever upload image database on parse.com, size gets reduced. have tried possible ways fix issue. tried saving image in sdcard , there, of proper size when try view in data browser of parse, shows me small image, of 50x50px. how can fix this?
my saving sd card code:
private void saveimage(bitmap imgmap,imageview imgview) { calendar ci= calendar.getinstance(); filenamestr="sdcard/sudhaar/"+ci.get(calendar.year)+"-"+(ci.get(calendar.month)+1)+"-"+ci.get(calendar.day_of_month)+"_"+ci.get(calendar.hour_of_day)+"-"+ci.get(calendar.minute)+"-"+ci.get(calendar.second)+"-"+ci.get(calendar.millisecond)+".jpg"; try { fileoutputstream imgout=new fileoutputstream(filenamestr); imgdata.compress(bitmap.compressformat.jpeg,100,imgout); imgout.close(); } catch (filenotfoundexception e) { toast.maketext(getapplicationcontext(), e.tostring(), toast.length_long).show(); } catch (ioexception e) { toast.maketext(getapplicationcontext(), e.tostring(), toast.length_long).show(); } catch (exception e) { toast.maketext(getapplicationcontext(), e.tostring(), toast.length_long).show(); } }
my upload parse code:
public void send_img(bitmap imgdata, string description) { bytearrayoutputstream stream = new bytearrayoutputstream(); imgdata.compress(bitmap.compressformat.jpeg, 100, stream); byte[] img = stream.tobytearray(); parsefile file = new parsefile("image.jpg", img); file.saveinbackground(); parseobject complain = new parseobject("complaint"); complain.put("description",description); complain.put("image", file); complain.saveinbackground(new savecallback() { public void done(parseexception e) { if (e == null) { toast.maketext(getapplicationcontext(),"complaint posted!", toast.length_short).show(); pdialog.dismiss(); finish(); } else { pdialog.dismiss(); toast.maketext(getapplicationcontext(),"sorry ! please try again", toast.length_short).show(); } } }); } }
use curl cli interface manually post file parse.com
consult 'rest api docs' section='uploading files'
use curl/rest api upload file.
save parse file url in response prior post.
use url download , check file length.
you see not changing file size in post.
then, can either shift rest api in app or figure out sdk or app code doing compression note in post.
Comments
Post a Comment