Skip to content
This repository has been archived by the owner on Dec 2, 2019. It is now read-only.

Return resized thumbnail (only Android) #28

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

zanfirovidius
Copy link

Added getResized(String filePath, Integer maxSize, Promise promise) This will return the thumbnail resized to size that will not exceed (width or height) the maxSize parameter.

For our case-use we needed an way to optimise the loading of the thumbnails in an FlatList. And one of the steps was to resize theme to a smaller one based on the device screen and not load an 1080 thumbnail when we just need an 400.

The usage will be similar to the other function with the exception of an additional parameter which will define the size of the thumbnail.

import RNThumbnail from 'react-native-thumbnail';

RNThumbnail.getResized(filepath, 400).then((result) => {
  console.log(result.path); // thumbnail path
})

This will work only for Android!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant