# 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](https://docs.sharinpix.com/documentation/cookbook/utils-methods)
{% endhint %}
