Skip to content

Tag: image

Sending a profile picture from react frontend to flask-restful backend and storing

I want to store profile pictures on the file system (images/{username}_pfp.{extension} and store its location in the database as a string. My frontend react code is and my flask backend code is I have gotten the bits of code relevant to this from multiple sources (Flask – Get the name of an uploaded file minus the file extension, When

background image not showing in React

Public>images>img-2.jpg src>components>pages>Services.js> src>>App.css> src>App.js> This is how I wrote the code. But the picture not working. Screenshot(Failed to compile) Images are not displayed, how can I display images? Please help me. Answer You shouldn’t keep your images in the public folder. When using css inside the src folder you should use the relative path to the image file and during

Display multiple random images rather than just the one

The code below displays one image from an array at random. I’ve been trying to change it without success to show all the images from the array at random. I’ve used a while loop to generate the random function. The random function works and randomises the whole array but only on image is returned. There are 8 images in the