Version: 1.0.0

Advanced - Medias

Potion offer you a very easy way to manipulate your media resizing on the fly. If you choose to upload your media to our server, those informations can be helpful.


Medias API

Once you have uploaded a media via Potion's APIs, you have the possibility to manipulate its dimensions very easily. Lets say you want to resize your brand new cat picture in order to display it as an avatar. You simply have to make an HTTP GET request to the following endpoint /public-api/v1/media_files/MY_MEDIA_ID/WIDTHxHEIGHTCROP_METHOD. Lets explain those parameters.

Width

As you can guess it will be your desired width output.

Height

And yes, it will be the desired height output.

Crop Method

Here come the interesting parameter. You can provide one of those 3 parameters :

  • > : This parameter will resize the image only if the original image dimensions are superiors to your size parameters
  • < : This parameter will resize the image even if the original image dimensions are inferiors to your size parameters. To put it in a nutshell, image will be upscaled.
  • c : This parameter will crop the image to the desired dimensions, you can request sizes superior to your original image.
curl -X GET \
https://YOUR_PROJECT_DOMAIN.potion.social/public-api/v1/media_files/MY_MEDIA_UID/200x200c \
-H 'Api-Key: YOUR_API_KEY' \
-H 'Api-Secret: YOUR_API_SECRET' \
-H 'Content-Type: application/json' \

Note about medias

For performance reason, medias manipulation via API superior to 6000px width or height won't be applied. You are also limited to 10Mb max file size.