Upload Assets

24 June 2020

  • C10 - removed extended image file formats in favor of built-in types.

27 May 2017

  • Release 9.164
    • Added optional mono parameter when uploading scripts.
    • The command returns script compilation errors.
    • The command updates inventory assets such as notecards and scripts if they already exist in the inventory.
    • The command now uses the Corrade permission system notation.

13 July 2016

  • Release 9.105 - the command now returns both the inventory item UUID and the asset UUID of the uploaded item (if any).

10 July 2016

  • Relese 9.104 - added extended formats for the Windows platform.

4 May 2015

  • Release 7.82 - Corrade now supports uploading multiple image formats for the Texture asset type.

14 December 2014

  • Release 7.28 - added.
upload (Commands)
TypeCorrade progressive command
Commandupload
DescriptionThe upload command can be used upload assets onto the grid.
Permissionsinventory, economy
Parametersgroup, password, name, type, data
Last ChangesRelease 9.164 - Added optional mono parameter when uploading scripts; The command returns script compilation errors; The command updates inventory assets such as notecards and scripts if they already exist in the inventory; The command now uses the Corrade permission system notation.

The upload command can be used upload assets onto the grid.

Command Required Parameters Required Corrade Permissions Example
upload group, password, name, type, data inventory, economy
llInstantMessage(CORRADE,
    wasKeyValueEncode(
        [
            // Create a script called "Good day!"
            // with the content passed to "data"
            // and set permissions to MODIFY COPY.
            "command", "upload",
            "group", wasURLEscape(GROUP),
            "password", wasURLEscape(PASSWORD),
            "name", "Good day!",
            "type", "LSLText",
            "data", wasURLEscape(llStringToBase64("
                default {
                    state_entry() {
                        llOwnerSay(\"Good day!\");
                    }
                }
            ")),
            // "Copy" and "Modify" permissions.
            "permissions", "c--mvt------------c--mv-c--mvt",
            "callback", wasURLEscape(URL)
        ]
    )
);
Optional Parameter Description
description The description of the asset.
permissions The permissions in Corrade permission system notation for the next owner (this option is ignored for Landmarks which always have full permission).
item If an item by name or inventory path (ex: /My Inventory/Notecards/MyNote) is specified, then that item will be updated and no new item created.
mono When uploading a script, if mono is set to True (by default set to True) then Corrade will use the mono compiler instead of LSO.

The possible and currently supported uploadable assets are the following:

Parameter Possible Value Parameter Description Example
type Texture Uploads a texture that is encoded in either JPEG2000 or one of the other supported formats.
llInstantMessage(CORRADE,
    wasKeyValueEncode(
        [
            // Upload a texture and call it Skull
            "command", "upload",
            "group", wasURLEscape(GROUP),
            "password", wasURLEscape(PASSWORD),
            // The name as it will appear in the
            // inventory textures folder.
            "name", "Skull",
            "type", "Texture",
            // The Base64-encoded image binary data.
            // (This is a small skull texture in TGA
            // format that has been encoded to Base64)
            "data", wasURLEscape("
                iVBORw0KGgoAAAANSUhEUgAAAEAAAABAAQAAAACCEkxzAAAAAnRSTlMAAQGU/a4A
                AADySURBVHgBjdK3lQMhGATgQd6jUBltXCJTikq48LJlnxpDZ9tAHWwow4Mb/t3z
                dqIPb5Ga/AGgEARACyqgLXAABOgHrInIrtYQQbGbJo7seewTLKWY4Q3nbGesiZJw
                BeEyEuOJUlA0qN6j/QHH9XsYYkG0iDjI0N8hLBpEwUQfZwMC87ZvgTNbKK9qwEGw
                cc7ajNLv/TZvdeecYL+zbiuwykPg2hU8Ufr+UeWtKt8P7Srv8Di/08c1eBFVOwkO
                VfsgsNdte8M+wNUTIDCxXh06AHnRiQ4TRRxXOpg+kSKR/g3lGwBrQXqFRVHDqVQj
                mN//xjODplxESg0eZQAAAABJRU5ErkJggg==
            "),
            "callback", wasURLEscape(URL)
        ]
    )
);
Sound Uploads a sound in OGG Vorbis format.
Animation Uploads an animation in .animatn format.
Clothing wear Uploads wearables for a certain clothing slot (wear) set to one of the values of the WearableType enumeration.
Bodypart wear Uploads body parts for a certain slot (wear) set to one of the values of the WearableType enumeration.
Landmark Uploads landmarks.
Gesture Uploads gestures.
Notecard Uploads notecards.
LSLText Uploads scripts.

and the data passed to the data parameter is compatible with the data retrieved by the download command.

Supported Texture Image Formats

Grid clients such as Corrade download and upload textures to the grid in the JPEG2000 image format. The JPEG2000 image format is defined with various profiles, such that if the downloaded image is saved to a file and then inspected by the file or exiftool command line utilities, the detected image description should be:

JPEG2000 codestream

which indicates a Profile 0 JPEG2000 which is what the SecondLife grid is using.

The proper file extension for such images is "j2c" which stands for "JPEG2000 codestream". Some tools may not properly implement nor respect the file extension. One tool that manages to correctly convert images to "JPEG2000 codestream" is ImageMagick with the mogrify tool. For instance, supposing that an image x.png exists in the current directroy, then issuing the command:

mogrify -format "J2K" x.png

will result in a new image created x.j2k that, when inspected with the file tool:

file x.j2k

should output:

x.J2K: JPEG 2000 codestream

Other tools, such as ffmpeg will convert an image that when inspected with the file utility will read x.j2k: JPEG 2000 Part 1 (JP2) which will fail to upload with Corrade to SecondLife.

Furthermore, Corrade follows the SecondLife limits on texture uploads without any processing such that the user must ensure that the texture to be uploaded conforms to the specification.

One condition imposed by SecondLife is that the height and width of the image should be a power of 2 otherwise the image will not be uploaded. When uploading with a regular viewer, the viewer disguises a transformation that changes the image such that the width and height are a power of 2. However, when using Corrade, this transformation has to be performed beforehand in order for the upload to succeed.

2021/05/26 06:23

Supported Sound Formats

Corrade uploads OGG Vorbis files with the same specification that is listed on the official wiki. In case the uploaded sound seems distorted please check that all the parameters have been met. Typically, the audio rate is the culprit for most sound distortions and one must make sure that the rate of the file to be uploaded is $44100Hz$.

Encoding Assets for Upload

For example, to upload a texture, you would have to have an image encoded in one of the supported image formats. For this example, let's assume you have a JPEG2000 image. You would Base64-encode the JPEG2000 code-stream image. After that, you send the upload command to Corrade with the value of the data key set to an URL-encoded string of the Base64-encoded JPEG2000 code-stream image.

In other words:

  • you have an initial JPEG2000 code-stream image file.
  • you encode the image file as a Base64 string.
  • you encode the Base64 string in an URL-encoded string.

The reason for multiple levels of encoding is that Base64 uses the equal sign (=) as a padding element which interferes with key-value data syntax.

Since Base64 encoding may produce large strings, a reliable way to upload assets is to use Corrade's internal HTTP server instead of writing large strings in LSL.

Assets such as clothing, landmarks, gestures, notecards and scripts can be uploaded (created) as the reverse operation of the download command. Each of these assets are Linden-based formats which, some of them, can be reconstructed intuitively in plain-text. For example, scripts as LSLText requires the encoded data to be just a plain-text LSL script. Landmarks, clothing, gestures and notecards also have their own specific Linden-based format. If you are curious to see what that format may be, use the download command on some clothing and then Base64 decode the data returned by Corrade.

Returned Data

Under the assumption that the upload succeeded, Corrade will return a CSV list of item UUID by asset UUID (if any) that can then be used for other commands in order to refer to the asset that has been uploaded. Additionally, if the asset was a script and the script failed to compile, then the command will return the script compilation errors.


secondlife/scripted_agents/corrade/api/commands/upload.txt ยท Last modified: 2023/07/21 10:39 by office

Access website using Tor Access website using i2p Wizardry and Steamworks PGP Key


For the contact, copyright, license, warranty and privacy terms for the usage of this website please see the contact, license, privacy, copyright.