kmes055 / AutoDrawer

Capstone project in dept. of CS. Application for designers, artists using TextureGAN, DisgoGAN
0 stars 1 forks source link

File Send/Receive #30

Closed hacking-racoon closed 4 years ago

hacking-racoon commented 4 years ago

I implemented this feature. In android-java.

to make this feature work well, I'm studying React Java,

Afterwords, I will implement this feature in React Java.

I used 'xampp' to open my apache server.

I encoded image to base_64 format, and uploaded to my server. (using volley library)

well done!

To put in our application, However, It should be implemented by React Native.


To receive image files,

I needed to write upload.php

and I used Atom IDE.

hacking-racoon commented 4 years ago

I implemented this feature. In React Native Expo. I used expo-image-picker & expo-permissions.

To implement in RN Expo environment is much more easier than Android Studio. However, I had some troubles on that.

  1. php.ini ---- post_max_size, upload_max_size value was too low
  2. typo.

these error were solved by checking server log file. I learned a lot about that.

hacking-racoon commented 4 years ago

However I still have technical difficulties for file_receive_transfer.

That is. 'How to know whether the conversion is done or not?'

and, I will solve this problem with async function.

for this work well. I would learn Node.js.

ll RN ll -> async upload -> async requestPicture llServerll -> requestConversion -> llGoogle Colabll

-> llserver ll ---- image --> ll RN ll

kmes055 commented 4 years ago

@hacking-racoon Can you write the comment describes transaction file format here? or you can just check and point out any wrong in my description below.

Values are just sample strings. please not focus on value, but key.

method: POST(maybe additional GET request after transform)

method.body{ 'file': file { 'type': 'image/jpg', 'uri': <selectedPicture에 저장된 uri>, 'name': 'uploadimagetmp.jpg', 'token': # Not should be called by API. any unique string is okay, we can discuss this in meeting. } 'submit': 'ok' # maybe variable for check in client environment? }

kmes055 commented 4 years ago

Additionally, I need some more information on the client's request.

kmes055 commented 4 years ago
hacking-racoon commented 4 years ago

There are entire process of appending body. (on upload prototype)

let uploadData = new FormData();
uploadData.append('submit', 'ok');
uploadData.append('file', { type: 'image/jpg', uri: this.state.selectedPicture, name: 'uploadimagetmp.jpg' });

It has only 2 key : 'submit', 'file'

If you require any other key&value, please add comments.

kmes055 commented 4 years ago

Draft of the JSON structure

'sketch (changed from file) ': { 'content_type': 'image/jpg', 'uri': \<uri address of sketch image>, 'name': + '.jpg', 'token': , } 'submit': 'ok'

Add

'category': String. should be one of 'bag', 'shoes', 'hat'. default: null(MUST selected by the user.) 'get_recommendation': Boolean. If true, we'll show other categories. default: True. 'pattern': { 'Is_color': Boolean. the backend part of reading 'image_info' is dependent on this. 'content_type': String. pattern is an image, image/jpg, image/png, etc. BUT must be 'text/plain' if pattern is a color. 'image_info(you can change the name as you want)': String. if is_color == true, 6-digit color information(RGB), else uri path of image. }


JSON data format is not mattered when well discussed and shared. don't afraid to say you should modify JSON format.