# CEAdImage

## Overview

`CEAdImage` contains the information of image icon.

## Interface

### `url`

#### Declaration

```
@property (nonatomic, copy, readonly, nonnull) NSURL * url;
```

#### Discussion

The local file url of the image file.

### `width`

#### Declaration

```
@property (nonatomic, assign, readonly) NSInteger width;
```

#### Discussion

The width of the image.

### `height`

#### Declaration

```
@property (nonatomic, assign, readonly) NSInteger height;
```

#### Discussion

The height of the image.

### `- initWithFilePath:`

#### Declaration

```
- (nonnull instancetype) initWithFilePath:(nonnull NSString *)filePath;
```

#### Parameters

| name     | description                       |
| -------- | --------------------------------- |
| filePath | The local file path of the image. |

#### Return Value

A `CEAdImage` instance.

#### Discussion

The `filePath` should have `file://` prefix and point to a existing image file on the disk. The width and height properties are both 0 for those constructed from this initializer.

### `- initWithURL:width:height:`

#### Declaration

```
- (nonnull instancetype) initWithURL:(nonnull NSURL *)url width:(NSInteger)width height:(NSInteger)height;
```

#### Parameters

| name   | description                                          |
| ------ | ---------------------------------------------------- |
| url    | A `NSURL` object which points to a local image file. |
| width  | The width of the image.                              |
| height | The height of the image.                             |

#### Return Value

A `CEAdImage` instance.

#### Discussion

The `filePath` should point to a existing image file on the disk.

### `- loadImageAsyncWithBlock:`

#### Declaration

```
- (void) loadImageAsyncWithBlock:(nullable void (^)(UIImage * __nullable image))block;
```

#### Parameters

| name  | description                            |
| ----- | -------------------------------------- |
| block | Callback invoked when image is loaded. |

#### Discussion

This method load the image from `url` in background and invoke `block` on main thread when image is loaded.
