What is the code to upload image?

I am a very beginner of programming
I am glad if you guys can give me an answer to it.

Hi there!

Can you give us more information so we can assist you? What language/frameworks are you using and what are you trying to accomplish?

Thank you, Jason

I know the code below can add new item with text data.
addedarray.add(new JSONObject().put(“objectID”, “myID1”).put(“firstname”, “Jimmie”).put(“lastname”, “Barninger”));
mindex.addObjectsAsync(new JSONArray(addedarray), null);

And, is there any other method to create item with image?
shall I use firebase to store the image resource, and then create linkage to the algolia?

Hey,
You don’t have to push any images to Algolia. You just need to provide the url of your image hosted anywhere (follow best practices about the size and compression of your assets, we recommend to use an image service api like cloudinary). Then all you have to do is to use it in your hit. Your template should look like <img src=“{hit.imgUrl}” title=“{hit.name}” width=120 height=200 />

1 Like