CRecordWebLoadImage

The CRecordWebLoadImage message loads an image file from a node's FileStore. If the image is available in the FileStore of the local node (the web server), the specified HTML element will be updated.

The message is part of the RemoteSkin Web API.
The API is located in the plugin NY_RemoteSkinWebProtocolAPI.

{
  "id": "484ecbf3-636f-4bff-8571-aa9fbc215ff7",
  "name": "WEB_LOAD_IMAGE",
  "description": "Load an image and update the HTML element after loading.",
  "slots": [
    {
      "key": "1",
      "name": "RELATIVE_PATH",
      "direction": "REQUEST",
      "mandatory": "true",
      "type": "STRING",
      "description": "The relative path of the image."
    },
    {
      "key": "2",
      "name": "ELEMENT_ID",
      "direction": "REQUEST",
      "mandatory": "true",
      "type": "STRING",
      "description": "The ID of the element to update."
    }
  ]
}

Arguments

  • RELATIVE_PATH : All files in a FileStore are identified by a relative path.
    Example: “/app/MyApp/images/goofy.png”
  • ELEMENT_ID: The element ID to update.

Usage with the helper class CWebApi

The easiest way is to call the corresponding method in the CWebApi class. The use of the class is described there.

mWebApi.loadImage(@NotNull final String aRelativePath,
                  @NotNull final String aElementId);

Usage as message

The RemoteSkin target address is also required.

public void loadImage(@NotNull final CTargetAddress aRemoteSkinAddress,
                      @NotNull final String aRelativePath,
                      @NotNull final String aElementId) throws CException
{
    // Envelope
    final CEnvelope env = CEnvelope.forSingleTarget(mRemoteSkinAddress);
    
    // Record
    final CRecord record = CRecordWebLoadImage.create();
    CRecordWebLoadImage.setRelativePath(record,
                                        aRelativePath);
    CRecordWebLoadImage.setElementId(record,
                                     aElementId);
    
    // send message
    sendNotification(env,
                     record);
}

See also: