# assets

Canonical URL: https://developers.iagenify.com/zh/sdk/ref/brand-object/assets/
Language: zh

`brand.assets.add(asset) · update(id, changes) · remove(id) · byRole(role) · last · lastCredits`

品牌展示时使用的照片、视频和插图：店面、产品、团队。SDK 0.5.2+。

Status: 60 at most · 25 MB uploaded · 200 MB from Cloud · ~1 credit to describe

```javascript
// A file already in the account's Object Storage: nothing is uploaded again.
await brand.assets.add({ cloud: "Brand/storefront.jpg", role: "hero" });

// Or bytes, like a logo.
await brand.assets.add({ name: "team.jpg", content: bytes, role: "team", description: "The roasting team" });

brand.assets.last;          // the resource just added, with its url
brand.assets.lastCredits;   // what its description cost
brand.assets.byRole("hero");
```

## 角色 {#roles}

`hero`、`place`、`interior`、`product`、`team`、`work`、`detail`、`texture` 或 `other`。

## 没有描述的照片会被自动描述 {#describe}

由一个模型撰写描述，约花费 1 个积分，以便代理或页面无需查看图片就能选出合适的那张。自行提供 `description`，或设置 `describe: false`，则不产生任何费用。同一文件添加两次会被复用：`lastReused` 会说明这一点。

- [Brand](/zh/sdk/ref/brand-object): 品牌包含什么，以及如何修改它。
- [api.cloud](/zh/sdk/ref/cloud): 存放这些文件的 Object Storage。

```python
# A file already in the account's Object Storage: nothing is uploaded again.
brand.assets.add({"cloud": "Brand/storefront.jpg", "role": "hero"})

# Or bytes, like a logo.
brand.assets.add({"name": "team.jpg", "content": image_bytes, "role": "team", "description": "The roasting team"})

brand.assets.last           # the resource just added, with its url
brand.assets.last_credits   # what its description cost
brand.assets.by_role("hero")
```
