How can I publish an image from a link to roblox with HttpService?

I want to send a GET request to that link and somehow upload it to roblox.

2 Likes

Do you want a button to be clicked and it opens a tab on the client’s computer via a link?

1 Like

Well, I wanted to do what I wanted to do but with HttpService.

1 Like

This does not have anything to do with luau. But Java or any other programming languages similar with websites.

1 Like

Then, how can I do it with python?

1 Like
  • Python is hard to input within Websites
  • I am not a Python scripter, The devforum is only meant for luau.

I think I will just close this post. I can find some help elsewhere.

Recommended. Why is there even a limit for words bro

If I am understanding you right, you want to create a website where a user can submit an image and it is uploaded to Roblox? If so, then you’ve gotta consider the following:

  1. You can’t have a link to your website in your experience. That’s against TOS.
  2. If you let anyone upload images to your account/group that is very dangerous, because you’d be responsible for the uploaded images. (there’s a solution to this below)

Instead, you could ask the user to go to https://create.roblox.com/dashboard/creations?activeTab=Decal, upload the image and provide the Decal ID.

If you still want to use Python to upload images, I suggest using flask for a web server, and rblx-open-cloud for uploading assets/oauth2.

You could use OAuth2 to upload the image to the user’s account instead, and then you could use data store service or messaging service to send the image ID to your experience after the user has uploaded it.


This isn’t exactly correct. The DevForum is a place for Roblox development, which is mostly luau, but can also be Python and other programming languages, because of Open Cloud APIs and other web APIs.

If you need further help with Open Cloud/OAuth2, you may ask here in the DevForum, if you need help with other parts of your website, then asking elsewhere like Stack Overflow is probably best for you.

I just want like an api endpoint to upload images from a link to the image. That is what I want.

For example, a user enters a prompt for an image generation AI, it uploads image to roblox, then shows the image

You could do this within Roblox somehow using a proxy, however I don’t know how to format multipart requests in lua, so I’ll show you how it could be done using a external Python server.

  1. First, create an Open Cloud API key. You could use an alt account to protect your main account if you’d like. Here’s how
    a. Go to https://create.roblox.com/dashboard/credentials, and make sure you’re signed in.
    b. Give it a name, something like ‘In-Game Image Uploader’
    c. under ‘Select API System’ choose ‘Assets API’ then ‘ADD API SYSTEM’
    d. under ‘Select Operations to add’ choose both ‘read’ and ‘write’, section two should look something like this:

    e. Next, go to the security section and add this IP: 0.0.0.0/0. Since we don’t know what IP roproxy uses, we have to whitelist every IP. If you’re using your own proxy use it’s IP address/CIDR.
    f. click ‘SAVE AND GENERATE KEY’
    g. save this key somewhere safe, we’ll need it later. Also, don’t share this key with anyone else, anyone with this key will be able to upload assets onto the user/group.
  2. In your python console, you’ll need to install both flask and rblx-open-cloud, like this:
    pip install Flask
    pip install rblx-open-cloud
    
  3. In a python file, add the following code:
    in the python code, make sure to add your user id and api key.
from flask import Flask, request
import requests
import rblxopencloud
import io

# replace 1234 with your user id.
creator = rblxopencloud.User(1234, "replace this with your api key")
app = Flask(__name__)

@app.route("/api/roblox-images/upload", methods=["POST"])
def api_robloximages_upload():
    image_response = requests.get(request.json["uri"])

    if not image_response.ok:
        return "Invalid URI", 400

    image_file = io.BytesIO(image_response.content)
    image_file.name = "image.png"

    asset = creator.upload_asset(image_file, rblxopencloud.AssetType.Decal, request.json["name"],
        description="Uploaded with Open CLoud", expected_robux_price=0)
    
    if not isinstance(asset, rblxopencloud.Asset):
        while True:
            status = asset.fetch_operation()
            if status:
                asset = status
                break

    return {
        "id": asset.id
    }, 200

app.run("0.0.0.0", 8080)

now, once you’ve got it hosted somewhere, you can then access it in your game like this

local uri = "https://cdn.discordapp.com/attachments/902089426199519285/1140158853674184704/example_image.png"

local response = HttpService:RequestAsync({
	["Method"] = "POST",
	["Url"] = "DOMAIN NAME HERE/api/roblox-images/upload",
	["Headers"] = {
		["Content-Type"] = "application/json"
	},
	["Body"] = HttpService:JSONEncode({
		["uri"] = uri,
		["name"] = "example name"
	})
})

print(response)

where uri is the image link you want to upload. i really hope this helps. if you’re having problems hosting your python code, you can always search for help on other sites like Stack Overflow or YouTube.

Hmm, this is actually a good idea! I’ll try to use Vercel and host this.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.