2
$\begingroup$

I've built an API that takes a url of an image as an argument. Using Import[] I can easily call my API on any url and get the results... but I need to run it on an image created within my notebook.

What is the easiest (and free if possible) way to automatically upload my images and get back urls to feed into my API? I have roughly 100 jpeg images, each is a less than one mB.

Surely there is an easy way to do this, I mean with all this Wolfram-Cloud stuff now in circulation!

$\endgroup$
8
  • $\begingroup$ Why not just overload the API definition so it takes a file path as well as a url as a parameter? Assuming of course that your images are already local. $\endgroup$ Commented Feb 12, 2015 at 20:47
  • $\begingroup$ Because it is a client requirement to have locals trigger "Bad Request" (HTTP status code 400). $\endgroup$
    – M.R.
    Commented Feb 12, 2015 at 20:54
  • 1
    $\begingroup$ Can you elaborate the scenario a bit more? Im having trouble understanding. $\endgroup$ Commented Feb 12, 2015 at 21:00
  • $\begingroup$ Would uri = CloudExport[ExampleData[{"TestImage", "Lena"}], "JPEG"]suffice? Inside the cloud object there is a URI to the image. $\endgroup$
    – C. E.
    Commented Feb 12, 2015 at 22:51
  • $\begingroup$ That works thanks @Pickett $\endgroup$
    – M.R.
    Commented Feb 14, 2015 at 0:27

1 Answer 1

4
$\begingroup$

Images can be uploaded to Wolfram Cloud with built-in functions. Example:

uri = CloudExport[ExampleData[{"TestImage", "Lena"}], "JPEG"]

uri is an expression that contains the URI.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.