# convertImageToBase64

## Description

Converts an image to base64 format.

### Platform Supported

* Mobile
* Web

## Input / Parameter

| Name  | Description                                                                                                                                                                          | Input Type | Default | Options | Required |
| ----- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ---------- | ------- | ------- | -------- |
| image | The image to be converted, it can be a asset icon name, local file path or url. If the image is a url must not block [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS). | Text/List  | -       | -       | Yes      |
| extra | Extra parameters stored and passed to callback.                                                                                                                                      | Any        | -       | -       | No       |

## Output

| Description                                                               | Output Type |
| ------------------------------------------------------------------------- | ----------- |
| Returns 'true' if the image was passed and if not it will return 'false'. | Boolean     |

## Callback

### callback

The function to be executed when the image is successfully converted to base64 format.

#### Scenario 1

There is no parameter 'extra'.

| Description                                                                                 | Output Type |
| ------------------------------------------------------------------------------------------- | ----------- |
| The base64 of the image, it will return text or list based on the parameter 'image' passed. | Text/List   |

#### Scenario 2

There is a parameter 'extra'.

| Description                                    | Output Type |
| ---------------------------------------------- | ----------- |
| Contains the result and extra of the function. | Object      |

**Object**

| Key   | Description                                                                                 | Output Type |
| ----- | ------------------------------------------------------------------------------------------- | ----------- |
| data  | The base64 of the image, it will return text or list based on the parameter 'image' passed. | Text/List   |
| extra | The extra value.                                                                            | Any         |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.emobiq.com/emobiq-client/006-actions-and-visual-logic/action-reference/cordova/app/convertimagetobase64.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
