Hi dear community,
i have built a function that handles File Resources to transform them into images or videos or files. The principle is to have a single function that can be used by several endpoints. here's the header of this function:
In the endpoint, i get the proper file resource, but when i try to call the above function, i got the error message below:
if i put the above function "code" into the endpoint, it works. But then i have to duplicate the code in many endpoints, loosing the advantage of factorization.
Anyone has already faced that problem and solved it?
Note: why am i doing it like this? Because by default, as mentioned in the documentation, the file resource can be a Base64 string OR a URL:
PLUS the fact that i may not know by advance if the file is going to be an image, a video or a file like a PDF or other.
That's why i'm using inside my custom function, the built-in Get File Resource Data that returns the mimeType of a file. From which you can then create the image, video or file variable.