# Image methods

## Image methods

The SharinPix package provides the Apex class, **Image**, which includes methods that can be applied when manipulating images on Salesforce.

Methods:

* [moveImages](#moveimages)
* [exportAsContentDocument](#exportascontentdocument)
* [downloadImages](#downloadimages)
* [fetchAsBase64](#fetch-as-base64-1)
* [restoreImage](#restore-image-1)

### Image Method Example <a href="#image-method-example" id="image-method-example"></a>

#### moveImages <a href="#moveimages" id="moveimages"></a>

*global static List\<Object> **moveImages**(List\<String> lstImageIds, String destinationAlbumId)*

* Moves one or more images to another album. Note: This method can be used to move a maximun of 50 images at once. Example:

```apex
sharinpix.Image.moveImages(new List<String> { 'imageId1', 'imageId2' }, 'destinationAlbumId');
```

#### exportAsContentDocument <a href="#exportascontentdocument" id="exportascontentdocument"></a>

*global void **exportAsContentDocument**()*

* Exports a SharinPix Image to Salesforce as a Content Document. Example:

```apex
(new sharinpix.Image('public_id')).exportAsContentDocument();
```

#### downloadImages <a href="#downloadimages" id="downloadimages"></a>

*global static String **downloadImages**(List\<String> imageIds)*

* Get a URL that opens a zip including the images. Example:

```apex
sharinpix.Utils u = new Sharinpix.Utils(); 
sharinpix.Image.downloadImages(u.getAlbumImageIds(albumId));
```

#### fetchAsBase64 <a href="#fetch-as-base64-1" id="fetch-as-base64-1"></a>

*global static String **fetchAsBase64**(String url)*

* Converts an image to base64. Example:

```apex
sharinpix.Image.fetchAsBase64('https://app.sharinpix.com/image.png');
```

#### restoreImage <a href="#restore-image-1" id="restore-image-1"></a>

*global static String **restoreImage**(String imageId)*

* Restores a trashed SharinPix Image. Example:

```apex
sharinpix.Image.restoreImage('imageId');
```

{% hint style="success" %}
**Tip:**

The SharinPix package also includes the **Utils** class, which provides useful methods that can be used for image, album, tag management, and a lot more. For more information about the **Utils** method, please refer to the article below:

[Utils methods](/documentation/cookbook/utils-methods.md)
{% endhint %}


---

# 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.sharinpix.com/documentation/cookbook/image-methods.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.
