Godot Version
Godot v4.2.1
Question
I am dowloading and palcing in runtime images from an API.
As far as I know the way of doing it is like so:
func _on_http_request_request_completed(result, response_code, headers, body):
if response_code == 200:
var img = Image.new()
var img_error = img.load_jpg_from_buffer(body)
if img_error != OK:
print("error loading data to img:")
print(img_error)
var texture = ImageTexture.new()
texture.create_from_image(img)
$Sprite2D.texture = texture
$MarginContainer/TextureRect.texture = texture
else:
print("not ok")
But Im getting an errorcode 31.
The funny part is that Im also downloading the image as a file, and thats working fine.
I dont know what im possibly doing wrong, Ive checked here for other solutions but nothing seems to be working for me.
Tried other links ,other formats, changing from https to http…
here is the pastebin of all the file: extends Node2D@export var url = ""var extfunc _ready(): ext = url.ge - Pastebin.com
but there is not a lot more to see really