0

If this is my url for the image: https://static.www.nfl.com/image/private/h_100,f_auto,q_auto,c_fill,g_auto/league/jccqiejlzdigw2zwxx2n

I've previously downloaded images from a url that was http and not a server in the following code but can't figure out how to download an image from cloudinary.

 var imageURL = "http://www.nfl.com/static/content/public/static/img/fantasy/transparent/512x512/";
 var imageName =  imageURL + playerID + ".png";
 var localFileImage = playerID + ".png";
 var fileRepository = "/01 feedRepository/IMAGE_FILES/";
 var playerName = playerLastName + "_" + playerFirstName;

 getJSONFile(imageName, fileRepository);
 ...

I've tried this, which works from the terminal but not from AE:

app.system.callSystem("curl -o ~/Desktop/OLU474619.png https://static.www.nfl.com/image/private/h_100,f_auto,q_auto,c_fill,g_auto/league/jccqiejlzdigw2zwxx2n.png");
sbaden
  • 555
  • 3
  • 16
  • 30

2 Answers2

0

You can simply add fl_attachment in the URL to download the image: https://static.www.nfl.com/image/private/h_100,f_auto,q_auto,c_fill,g_auto,fl_attachment/league/jccqiejlzdigw2zwxx2n

If doing programmatically then pass it as a flag("attachment") in the transformation. For your case, the first option should do.

Aditi Madan
  • 236
  • 1
  • 6
  • It downloads a .webp file which I can't open. I've tried adding a .png to the end but the results are the same. Also, can I control where the file is downloaded? – sbaden Jul 29 '20 at 19:58
0

I realized that the app.system.callSystem() does actually work but without app.

So it would look like this:

system.callSystem("curl -o ~/Desktop/OLU474619.png https://static.www.nfl.com/image/private/h_100,f_auto,q_auto,c_fill,g_auto/league/jccqiejlzdigw2zwxx2n.png");

This allows me to download the cloudinary image to a specific directory with simplicity.

sbaden
  • 555
  • 3
  • 16
  • 30