c# - What's is th best way to manage pictures WP 8.1 -


actually i'm developing "social" app office , i'm wondering what's best way load or manage pictures. each user has profil picture , display wherever want, on profil view, in contacts list (little smaller) example. when user creates profil, picks picture picture library on phone , it's send server base64 encoded string. code i've used save picked picture on server (sql server 2012 database):

var reader = new datareader(picturestream.getinputstreamat(0)); byte[] bytes = new byte[picturestream.size]; await reader.loadasync((uint)picturestream.size); reader.readbytes(bytes); string bytesstring = convert.tobase64string(bytes); 

so here bytesstring contains base64 encoded picture send on server. atually, i'm facing 2 problems.

first problem:

the base64 encoded string cannot inserted database if column type varchar(max). string cut in table.

second problem:

if want build picture bytesstring decoding base64 string, takes time it's not possible work that.

so i'm wondering how applications such instagram or other picture specialized application managing pictures well... give me advises manage pictures through app ? in advance !

two ideas come mind:

1. store images in binary-type column

i haven't used sql server much, guess there binary column type in can store original bytes of image.

2. store images in files instead of database.

another thing can store images in files names based on users' ids (i.e. user_15.png).

other considerations

is there reason encode/decode bytes? sending original image seems better option me.

how sending encoded image bytes? understand varchar(max) should able hold quite lot of data. sure server receives right data?

on client (in wp 8.1 app) may want cache images, wouldn't need load them server every time.


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -