Uploading listing images through gameflip API

Is there a way to upload custom pictures with API from my PC without uploading them to an image hosting site like imgur first, then giving the link to the API?

1 Like

Just upload to server

In the call to gfapi.upload_photo, just specify the file name (in the same directory) as photo_url.

So instead of gfapi.upload_photo(listing.id, photo_url, 0), you would do gfapi.upload_photo(listing.id, photo_filename, 0).

This function takes either URL or photo (as you can see in the code).

1 Like

i tried this before but the image would end up getting squashed

i tried this before but the image would end up getting squashed

If you use a large image (or not a square dimension), then the image would be squashed. Try a smaller image (e.g. 300kb or something like that).

1 Like

How do I format the path to the file? IF I do like ‘C:Users/…/xy.jpg’; then I get the Error: Invalid URI error. If I just write xy.jpg then I get an error aswell.

put the picture into the same folder as your js files (probably your sample folder) and specify the file name instead of putting a url like this

if you get a error like this , then obviously the image is too big and you’ll need to compress it

Im not sure what is the problem, Im doing it like this but I still get the error. The image is in the directory where the script is.
name: ‘RequestError’,
message: ‘Error: Invalid URI “test.png”’,

Still couldnt figure it out :confused:

weird. everything looks right to me :confused:

Try putting the image file in the same folder where you launch the script.

It is in the same directory, both the script and the picture is in the gfapi/src/samples folder

I meant same folder where you run the script. So if you launch the script in node src/samples from the gfapi folder, then try putting the photo in the gfapi folder.

If that doesn’t work, try to specify the full path with \\ (two backslash) as specified https://nodejs.org/api/path.html#path_windows_vs_posix

Windows is in its own world with file path backslash.

1 Like

Hello @Surpressed,

This case may help you: https://gameflip.zendesk.com/hc/en-us/requests/new

Try uploading the image to a hosting site and copying the direct link into the photo_url.

If not, I hope that the others info will work. They should be more helpful at this, I’m more of a developer than this style.

Hello Everyone :wave:
For the next people who might ask the question. I found a solution to host your photos simply and make them accessible for your requests.
You can use AWS (Amazon Web Services) and create an S3 instance. It’s like a dropbox or google drive but in my case the api was not able to retrieve my images through these hosts. :-1:
It’s free and easy to set up! I share a link below but there are a lot of videos on YouTube.

I hope this will help :grinning:
Good day to all

I still got problems with this, wiriting here to bump the thread. Has anyone come up with a solution?

Still got the problem

Did you ever find a solution?

every time i upload images directly dont know there is other way too