Image Manipulation with imgproxy
imgproxy is a fast and secure standalone server for resizing and converting remote images. With this tutorial you'll deploy the open-source imgproxy container from DockerHub to enable low-latency image manipulation close to your end users.
Before starting, create a new Section Project and then delete the default Deployment and
ingress-upstream Service to prepare the project for your new deployment.
Create a Deployment for imgproxy
Create the deployment for imgproxy as
imgproxy-deployment.yaml. This will direct Section to run the imgproxy open source container.
- image: darthsim/imgproxy:latest
Apply this deployment resource to your Project with either the Kubernetes dashboard or
kubectl apply -f imgproxy-deployment.yaml.
Expose imgproxy on the Internet
We want to expose the imgproxy on the Internet so that it can serve image manipulation requests. Create
ingress-upstream.yaml as defined below.
- name: 80-80
Apply this service resource to your Project with either the Kubernetes dashboard or
kubectl apply -f ingress-upstream.yaml.
See the pods running on Section's network using
kubectl get pods -o wide.
-o wide switch shows where your container is running according to the default AEE location optimization strategy. Your container will be optimally deployed according to traffic.
Experiment with imgproxy
Now, you can start using imgproxy. To resize the following image:
You use the following URL:
Using the URL above, imgproxy is instructed to resize it to fill an area of 300x400 size with “smart” gravity. “Smart” means that imgproxy chooses the most “interesting” part of the image.