React image resize
![react image resize react image resize](https://i.pinimg.com/originals/3d/db/88/3ddb884a21ca146c0bc2df03c1c61159.png)
The way we tell Filestack’s API to apply a certain image manipulation is the same as before, just add the parameters in the URL. Have you noticed the difference? The first picture maintains the proportions so the height is not 300px, while the second it exactly 400×300 as we added fit:crop. However, we can still add another parameter, fit:crop so that any parts of the image that don’t fit within the boundaries gets removed: However Filestack tries to maintain the original proportions so the height may not be processed. So, the complete url for a picture uploaded on Filestack could be
![react image resize react image resize](https://3.bp.blogspot.com/-HbSLgTvOheM/W7CeICzV5rI/AAAAAAAAB9k/T4q1Ytyhm3gWUKWGAZMsV5snMpaxElQgwCLcBGAs/s1600/cover.png)
If you take a look at the UI, you see that the first option in the form allows user to resize the picture:Īccording to the documentation, we can customize the picture URL by adding for instance /resize=width:500,height:500. So now I can add an uploader button in my React components. Right before the bundle.js created by Webpack! Then, in the entry point of my app, /src/index.js I set the key: tKey('YOUR_API_KEY') This is something that I usually take for granted and don’t cover in the articles but it’s in fact a necessary step. The complete app is available on my github! Filestack Integrationīefore diggin’ into the Image Manipulation section of Filestack I want you to remember that to start using Filestack we need to include it in our index.html file and set the API key. I customized some basic Bootstrap tutorial, added React to handle the views and communicate with the json-server, our mock API to retrieve and add new pictures. In fact it doesn’t take too much time to write this sample app: For now, let’s take a look a the UI: Homepage
![react image resize react image resize](https://www.mindfusion.eu/product_images/javascript/library/diagram/javascript-shape-nodes.png)
PhotoStack is a simple web-service: Users first upload their pictures and then apply a few image manipulations: