Git Product home page Git Product logo

filepreviews.js's Introduction

⚠️ Deprecated ⚠️

FilePreviews.io

Build Status

JavaScript client library for the FilePreviews.io service.

How to use

Install using bower

bower install filepreviews

Use from our CDN distribution

<script src="https://dufozrddxzwdn.cloudfront.net/2.0.3/filepreviews.min.js"></script>
<script src="https://dufozrddxzwdn.cloudfront.net/2.0.3/filepreviews.js"></script>

Download

You can also download the latest version from the releases page.

Example code

var previews = new FilePreviews({
  debug: true,
  apiKey: 'API_KEY_HERE'
});

previews.generate(url, function(err, result) {
  console.log(result.id);
  console.log(result.status);

  previews.retrieve(result.id, function(err, result) {
    console.log(result);
  });
});

Options

You can optinally send an options object.

var previews = new FilePreviews({
  debug: true,
  apiKey: 'CLIENT_API_KEY_HERE'
});

var options = {
  size: {
    width: 250,
    height: 250,
  },
  metadata: ['exif', 'ocr', 'psd'],
  format: 'jpg'
}

previews.generate(url, options, function(err, result) {
  console.log(result.previewURL);
  console.log(result.metadata);
});

Build

$ git clone https://github.com/GetBlimp/filepreviews.js.git
$ cd filepreviews.js
$ npm run build

Publish

$ npm run publish

filepreviews.js's People

Contributors

gcollazo avatar jpadilla avatar elving avatar todrobbins avatar

Stargazers

 avatar Jonathan Pribesh avatar Douglas Nassif Roma Junior avatar Peter Thanakrit Weekhamchai avatar jasine avatar Adrian Unger avatar Gabe Montalvo avatar Andy Britcliffe avatar  avatar Eugene MechanisM avatar Joohun, Maeng avatar Jose Padilla avatar M Haidar Hanif avatar Kenta Murakami avatar Martin Høst Normark avatar Igor Korsakov avatar  avatar Neri Barnini avatar Hengki Sihombing avatar Paul Young avatar Iheanyi Ekechukwu avatar  avatar Javier Honduvilla Coto avatar Robb Knight avatar pixlab avatar Amit Erandole avatar João Paulo Pinheiro Teixeira avatar Jyrki Laurila avatar Chris Masters avatar Kevin Dente avatar Alexey Volkov avatar Gowtham avatar Michael Scott Hertzberg avatar MichaelPfuetze avatar  avatar Yuya Saito avatar Ben Lee-Cohen avatar RegisM avatar ishihara takashi avatar  avatar youxiachai avatar Julien Bouquillon avatar Rohit Trivedi avatar Thomas Stockschläder avatar Adam Holwerda avatar Jay Fallon avatar Nyro avatar James Wyse avatar 王新云 avatar Jidé avatar Joan P. avatar Jonah Ruiz avatar Andrew-David J. avatar  avatar

Watchers

 avatar James Cloos avatar  avatar  avatar

filepreviews.js's Issues

Preview URL is not encoded

If the file url has spaces in it, the preview url generated by the API returns a non encoded url. The problem with this is that if the url has spaces, the link fails since it is not encoded.

For example, notice the first url that it is not encoded and does not work. The second url works since it doesn't have spaces.
screen shot 2014-07-21 at 12 01 06 pm

A simple fix, could be this:

encodeURI(<previewURL>);

It's not a mayor issue, since this can be fixed on the client side of using the library.

Note: that their maybe other characters that may need encoding as well.

XMLHttpRequest.withCredentials should initially be false

This is somewhat obscure, but I'm working on a site that includes both your library and reactS3Uploader. Their code causes an error if withCredentials is set to undefined on an XMLHttpRequest. The spec also requires its value to initially be false.

It looks like you custom XMLHttpRequest code appears to result in withCredentials initially being undefined.

The result was that including filepreviews broke by other s3uploader.

Error: ENOENT: no such file or directory, lstat 'bower_components'

After following the instructions in the Github README, I was able to install filepreviews into my project. However when I try to run it, I get this error Error: ENOENT: no such file or directory, lstat 'bower_components'

I have npm install-ed and have everything up to date and during the install I saw bower_components being referenced but is not longer in the project. Has anyone else run into this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.