Skip to content

Commit

Permalink
Add docs for Fresco image attribution
Browse files Browse the repository at this point in the history
Reviewed By: passy

Differential Revision: D15900104

fbshipit-source-id: 90f53fefbedfa32ed275900542f94650f487a679
  • Loading branch information
oprisnik authored and facebook-github-bot committed Jun 20, 2019
1 parent 3307576 commit c22bdbe
Showing 1 changed file with 25 additions and 1 deletion.
26 changes: 25 additions & 1 deletion docs/setup/images-plugin.md
Expand Up @@ -61,4 +61,28 @@ client.addPlugin(new FrescoFlipperPlugin(
new NoOpFlipperPerfLogger(),
null,
leakTracker));
```
```

### Attribution

In order to annotate images with the context they are used in, you have to set a
caller context when loading the image. This can be any object, so for the simplest
case, a String will suffice.

```java
String callerContext = "my_feature";

// For DraweeViews:
draweeView.setImageURI(uri, callerContext);

// For prefetching:
ImagePipeline imagePipeline = Fresco.getImagePipeline();
imagePipeline.prefetchToDiskCache(imageRequest, callerContext);

// For manually fetching an image:
DataSource<CloseableReference<CloseableImage>>
dataSource = imagePipeline.fetchDecodedImage(imageRequest, callerContext);
```

If a caller context is supplied, the image will be properly attributed in the
Flipper image plugin.

0 comments on commit c22bdbe

Please sign in to comment.