Skip to content

Commit 305b50c

Browse files
committed
Move into separate tasks dir/sidebar branch
1 parent 44a5dd5 commit 305b50c

File tree

8 files changed

+310
-201
lines changed

8 files changed

+310
-201
lines changed

docs/manifest/manifest-tasks.mdx

Lines changed: 0 additions & 197 deletions
This file was deleted.

docs/tasks/build.mdx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
---
2+
id: build
3+
title: Building a manifest
4+
---
5+
6+
import Tabs from '@theme/Tabs';
7+
import TabItem from '@theme/TabItem';
8+
9+
<Tabs groupId="programming-lang">
10+
11+
<TabItem value="python" label="Python" default>
12+
This is how to build a manifest using Python.
13+
</TabItem>
14+
15+
<TabItem value="cpp" label="C++">
16+
This is how to build a manifest using C++.
17+
</TabItem>
18+
19+
<TabItem value="node" label="Node.js">
20+
This is how to build a manifest using Node.js.
21+
</TabItem>
22+
</Tabs>

docs/tasks/get-resources.mdx

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
---
2+
id: get-resources
3+
title: Getting resources from a manifest
4+
---
5+
6+
import Tabs from '@theme/Tabs';
7+
import TabItem from '@theme/TabItem';
8+
9+
Manifest data can include binary resources such as thumbnail and icon images which are referenced by JUMBF URIs in manifest data.
10+
11+
<Tabs groupId="programming-lang" >
12+
<TabItem value="js" label="JavaScript" default>
13+
This is how to get resources from a manifest using JavaScript.
14+
</TabItem>
15+
16+
<TabItem value="python" label="Python">
17+
18+
Retrieve binary resources such as thumbnails from the manifest data, use the `resource_to_stream` or `resource_to_file` methods using the associated `identifier` field values and a `uri`.
19+
20+
NOTE: Need to add example of using `reader.resource_to_stream()`.
21+
22+
```python
23+
try:
24+
# Create a reader from a file path
25+
reader = c2pa.Reader.from_file("path/to/media_file.jpg")
26+
27+
# Get the active manifest.
28+
manifest = reader.get_active_manifest()
29+
if manifest != None:
30+
31+
# get the uri to the manifest's thumbnail and write it to a file
32+
uri = manifest["thumbnail"]["identifier"]
33+
reader.resource_to_file(uri, "thumbnail_v2.jpg")
34+
35+
except Exception as err:
36+
print(err)
37+
```
38+
39+
</TabItem>
40+
41+
<TabItem value="cpp" label="C++">
42+
This is how to get resources from a manifest using C++.
43+
</TabItem>
44+
45+
<TabItem value="node" label="Node.js">
46+
This is how to get resources from a manifest using Node.js.
47+
</TabItem>
48+
</Tabs>

docs/tasks/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
id: common-tasks
3+
title: Common tasks
4+
---
5+
6+
There are a number of common tasks when working with manifests:
7+
8+
- [Reading manifest data](./read.mdx)
9+
- [Getting resources from a manifest](./get-resources.mdx)
10+
- [Building a manifest](./build.mdx)
11+
- [Writing a manifest](./write.mdx)
12+
- [Signing a manifest](./sign.mdx)

0 commit comments

Comments
 (0)