_setImage

Sets images for a company's profile.

Parameters

name

Which type of image is being set. Must be one of the following: app-header app-icon letterhead logo-square

Filedata

A Base64 data-uri string of the image data.

Example

Image used in this example is a 5x5 red dot, Filedata will usually have a much longer string for images.

FM_api(
    'Setting_setImage',[
      'name' => 'logo-square',
      'Filedata' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=='
    ]
);

Results

On Success

The 'num' value and 'img' content values can vary.

Examples:

Img contents (user id, image type, image name) are included if the format is logo-square or letterhead.

{"ok":1,"num":2,"img":"92447\/logo-square\/2.png"}
{"ok":1,"num":1,"img":"92447\/letterhead\/1.png"}

If the type is 'app-icon' or 'app-header':

{"ok":1,"num":1}

On Failure

If there is no "name" parameter set

{"error":"missing parameter: name"}

If the "name" parameter does not match any of the formats

{"error":"invalid parameter: name"}

If there is no "Filedata" parameter set

{"error":"missing parameter: Filedata"}

If the "Filedata" string cannot be recognized as an image

{"error":"failed to convert image"}

Last updated