[How-to] Use screenshot-basic and a self hosted image server

Hello to whom ever reads.

I just got around to testing out some things with the screenshot-basic API and a few different server host solutions, so I thought I’d make a general guide of how to setup what worked for me.

Now, I had a need to run my image server/host inside a docker container, so this example will be using docker, if you do not have any idea what docker is, go google how to install and or use it first.

I also did not want to use imgur or other sites.

So with that in mind, I stumbled across:

Imgpush acts as both an image host to view the image online, but also as host to send images too.

So, with that I simply ran it as per it’s readme.md.
Please review its configuration settings prior to starting

Please replace the obvious within the below.

docker run -v <PATH TO STORE IMAGES>:/images -p 5000:5000 hauxir/imgpush:latest

My run command was as follows.

docker run --restart always -e NAME_STRATEGY="uuidv4" -s -v /home/fivem/screenshots:/images -p 5000:5000 hauxir/imgpush:latest

Presto, I tested it with a curl from my local machine and it responded with the filename it generated and appeared in the location I specified. Also appeared in chrome when i used it’s http://IP:PORT/Filename.png. Great!

So onto screenshot basic…
To test, I used a command and a simple event trigger.

Please replace the obvious within the below.

AddEventHandler("Test", function()
local server =  'http://THE.IPADDRESS.OFYOUR.IMAGESERVER:5000'

exports['screenshot-basic']:requestScreenshotUpload(server, 'file', {encoding = 'png', quality = 0.88}, function(data)
    local t = json.decode(data) -- returns a table
   local link = format.string('%s/%s',server,t.filename)

    TriggerEvent('chat:addMessage', { template = '<img src="{0}" style="width: 50%; height: 43%;" />', args = {link} })
RegisterCommand('Screenshot', function() TriggerEvent('Test') end, false) 
RegisterKeyMapping('Screenshot', 'Testing', 'keyboard', '/') -- Keybind Default(Menu/Settings/Keybinds/FiveM)....

Please excuse errors, I’m on my phone

It should pop the screenshot up into your chat window. Cool right?

Now you have an image in your chat window.

But really the image is on your server, you recieved the name of the file on the server and used the image host to link and embed it into the chat via a html img.

Have fun with the screenshots!


Sorry for asking this, but since the main devtool isn’t working i have to ask, is this working ? or it’s broken like the main resource ?

What main resource?

It works just fine for me and my linux servers?

screenshot basic is not working since some days ago, but if this work i will try it


Bro, What are you smoking?

Give me some please, because it must be some good stuff!

Screenshot-basic hasn’t broken, at ALL, what ever you use as an image host or such is probably down.

I’m using imgur api to upload photos and it isnt working, stopped working of nowhere :confused: thats why i though that screenshot wasn’t working

Check your config and imgur account settings dude, can’t help you here unless you want to use your own self hosted image server.

Is working just fine for me and only takes a smidge of drive space and ram.