react native - How to insert image to TextInput after uploading immediately - react-native

I want to implement a post editing interface works as follow:
user can input text, and when he/she presses the image upload button, after the image is uploaded to the server, the uploaded image need to be inserted after the current cursor, and user can continue to input the text.
How can I achieve this in React Native?

What have you tried so far? It's always better to try and post your current code so that we can help you.
I see two parts to your question
1) Image uploading - You can use a library for picking the image (e.g - https://github.com/react-community/react-native-image-picker). Then when you get the asset url from the image picker library you can use a file upload library (e.g - https://github.com/aroth/react-native-uploader) to upload this to your server and get the stored url back from the server as the response.
2) Image Displaying - For this you can use a native and set its source using the url returned by your server.

Related

cache image using unique id (not based on URL) in react native

i have a one project. in that their is a list which i get from api and the api's response contains a one image url which frequently changes ,but in that one one part of image name is common and the image also a same. but the later half signature is changes whenever is called it.So how can i cache
this image in react native using any if the caching library or should i need to cache it manually ?
ex:- https://abcImage.png/..../.... (where .... contains any unique signature text)
Thanks in advance

How to upload custom image when create new channel

We need to have the ability to set a custom image for new channels.
From docs https://getstream.io/chat/docs/#initialize_channel, I can see the field image and if send here some remote URL - works fine.
But what to do when we need to send an image from the phone? For sending image for message I can see the functionality. But it's bonded to channel which is going to be created.
I know we can use base64, but I hope there is a better way of doing the required functionality? (like upload the image to server and get remoteURL)?

How can i upload an image if i'm navigating to a different component

I am working on a react native application where i an upload image button in the Upload screen and during the upload process if i navigate back to the previous screen the upload process is stopped but i would want to upload the image in background of the app.
I am sure where to start trying this.
how will i approach this problem. Is there is any package i could use, i am even persisting data in redux store after the image is uploaded so is there a way i can use redux to upload the image.
One way of doing would be.
You can show uploading indicator while uploading and then return promise to navigate whatever the page you want.

Has anyone been able to use web images with the Tiles and Badges App sample?

I've been trying to get my app's tile to display an image from the web, but couldn't get it to work. I then tried the Tiles and Badges app sample, where in scenario 3 you can send a tile notification that uses a web image. No matter which image url I paste in the text box, the tile refuses to get updated. So apparently, the sample isn't working either, or something is very wrong.
The images are all smaller than 1024x1024 and less than 200KB. Fun fact: if I download one of the images I unsuccesfully tried to feed the sample, add it to the project and then send a notification using it as a local image, the tile gets updated. So apparently the image isn't the problem.
Has anybody been able to get this working? I don't get what I'm doing wrong.
Do have internet permission ticket in app manifest? Maybe only your app dont have permission to download your image from web.

How to upload photos using CakePHP 2.0

I'm developing a simple web app and I just want to allow the user to upload some pictures.
should I just store the picture url on my database table or should I upload the whole picture?
how can I validate the size of the picture being uploaded?
how can I upload the picture from my controller?
thank you all!
I would NOT store the image data in the database. I would create a Behavior that will upload the image to the image directory and store a reference to that image. The behavior can then handle size, mime type, etc. Then add a file upload form to the controller and when the data goes to the model to be saved, it will automatically upload the image and put it where it goes.
If you do not want to build your own, here is a very popular behavior that someone has built.
https://github.com/jrbasso/MeioUpload
Or you could try this simple way of doing it (check the readme.md file) :
https://github.com/malikov/cakephp2.0-image-upload