Uploading an image with API


#1

Hello,

I’m trying to upload an image located on a distant storage with the oauth2 api, I’m giving this link : (http://192.168.0.21:5858/users_directory/image.jpg


I’ve tried it with different image format and size but nothing changed.


#2

You’d need to download that file to some temporary storage first and the upload it. Without seeing the code for your request, its hard to comment further.


#3

I’ll try to explain what I’m trying to achieve so maybe it’ll be easier.

My goal is too drop files (videos and images) inside a directory located on the machin that is hosting Xibo (but not in the same directory) and in the next few minutes, these files are displayed on the screens

And each X minutes, there is a script check the directory where files has been dropped and:

  • for an image : upload it to xibo and schedule it to be played on the displays
  • for a video : create a layout with a local video widget and schedule it to be played on the displays (working)

So if the script detects that the file is a image, it will call this function :


And that’s when the error occurred.

I also tested to upload the image manually using the CMS and it worked, but I can’t get it done with the api.


#4

So think you’re giving the $url parameter as the below?

And the error is saying that file is too small (0 bytes), which would be true because you’re trying to pull a file from a URL rather than a local path. If you gave a relative local path there, does it work?


#5

So yes that was the problem…
We found it a few minutes ago after hours of work, I haven’t seen your answer
Anyway it’s working with local path.

Thank you for your answers.