phuochau / react-native-thumbnail

Get thumbnail from local media. Currently, it only supports for video.
MIT License
135 stars 104 forks source link

Added options "saveToDir" and "uniqueNames" and removed peerDependencies #14

Open naxel opened 6 years ago

naxel commented 6 years ago

https://github.com/phuochau/react-native-thumbnail/issues/13

naxel commented 6 years ago

Added options "saveToDir" and "uniqueNames" (for using same images #3 )

//Example
let options = {
  saveToDir: '.app_thumbs', //default "/storage/emulated/0/thumb/"
  uniqueNames: false,// default "false", same names
};
const filePath = "/storage/emulated/0/DCIM/Camera/VID_20180116_202826.mp4";
RNThumbnail.get(filePath, options).then((result) => {
  console.log(filePath, result);
  /** result:
  {
    height: 320
    path:"file:///storage/emulated/0/DCIM/Camera/.app_thumbs/VID_20180116_202826.mp4.jpeg"
    width:240
  }
 */
});
phuochau commented 6 years ago

@naxel Thanks so much for making the change. Could you help to fix conflicts? And update the docs that these options only work on Android?

naxel commented 6 years ago

@phuochau It's only for Android now. I'm not an Android developer, so the code may be messy. I think I can help you to fix conflicts.

phuochau commented 6 years ago

Any updates @naxel , I just updated the master branch