Scaleforms and base64 images

Hello all,
does somebody know I could go with creating a texture from a base64 image ?
Maybe with DUI ? I don’t really know how they can be used

What I’m wanting to do is to use [RELEASE] MugShotBase64 to get a base64 image from the player once, and always use this image mainly for FeedPosts.
(Like take a mugshot to base64 from the player when joining the server after the player creation, and always use this image for the ID card)

I tried to use them like a normal image link as I have seen it possible in some kind of ways in Using HTML, images and blips in scaleform/texts, but, sadly, none of them worked

Thank you in advance :slightly_smiling_face:

PS : I know that I can use the base64 image link in a NUI, but my main goal is to try to use it with the game FeedPosts
like

1 Like

this native should do what you want
RegisterPedheadshot

This native allows me to get the mugshot of the actual player ped, but what I would like to do is use a saved as base64 image mugshot or any other image
(Thank you anyway :slight_smile: )

SetRuntimeTextureArgbData - Natives @ Cfx.re Docs (fivem.net)

1 Like

Hello, thank you for your answer

I tried to use this native but nothing I tried seems to work

Here is the code I used :

local imageBase64 =
    "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAAAXNSR0IArs4c6QAAEQ1JREFUeF7Nm11sI9d1x/+a4YyGHok7XHJpqZK1ZqRoLUcNqqC1vEK3hdXGG28SFHUSJED7EKAvBQK4SG2kCNqkQAs/+qE1kAZt0z60D8lDtwiKbLtNo8B20+2mixUCyGAsS+FKXZZaSgRpUiOOZjij4tyPmSGX2g+Kwe4BiOEMh8N7fvd/7j33g0MAjjBgmxjWsDhqsqdWDgOkVAUNP0DJc2Em/PDXzIQOKCo034fu+3BVFVBVeL4Pjd4D0BUFlUMPa017wKXkjxsaNIC483EABcdBSlXR8G3kDBNmQmMFsIMAputy58liAAiEHUR+/zwgDBTAuKbh/Cle82SlQw8aVDQDXusN30fOUEPn6ZrreewzTwDgWHjN254XAsgNaz8XJQwUwCXLQtX3QCq4F4C4lrUj7ryrKNCDAPRNGQK268IbEsoAQBBu1h3U287AwmGgAJZGLFgjvGxOW2jXceEcqTCGfHZ0FRHbqgLXD+ApgKkpqNgeTF2F23bZ940hwDkCHB8wE/w7O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)

Citizen.CreateThread(function()
    print("SetRuntimeTextureArgbData", SetRuntimeTextureArgbData(img_tex, imageBase64, #imageBase64))

    AddTextEntry("IMG_FEED_TEST", GetGameTimer())
    BeginTextCommandThefeedPost("IMG_FEED_TEST")
    EndTextCommandThefeedPostMessagetext("img_txd", "img_tex", false, 4, "title", "subtitle")
end)

It seems that SetRuntimeTextureArgbData always return false when I use it that way
I also tried to commit the texture with CommitRuntimeTexture - Natives @ Cfx.re Docs but it did not work

This is what the imageBase64 variable correspond to

I you can help a bit more I would be really thankful :slight_smile:

1 Like

The native takes raw ARGB data (so not a string or binary PNG), however it may be worthwhile to add an equivalent of CreateRuntimeTextureFromImage - Natives @ Cfx.re Docs supporting data: URIs or the likes.

1 Like

Oh ok, so actually the only way I could use this data: link would be with NUI

If this feature gets added I would be one of the first to use it then, I hope this native will exist one day :slight_smile:

No, not necessarily the case: you can decode a PNG any other way too.

1 Like

Well on this side I can’t promise anything but I’ll take a look at it

After some work I found a way to do this using NUI to get the data I need.

Here is the code I managed to do
base64toruntime.zip (8.0 KB)

Probably not the best way to do it, but it works ¯\_(ツ)_/¯

1 Like