GithubHelp home page GithubHelp logo

danzi's People

Contributors

nevill avatar tlvince avatar

Watchers

 avatar  avatar  avatar

Forkers

tlvince

danzi's Issues

Move the file name generator out

We should let user define the way to generate the uploaded filename.

Means, user can easily overwrite these two functions.

function generateNameWithExt(file) {
  var name = '';
  for (var i = 0; i < 32; i++) {
    name += Math.floor(Math.random() * 16).toString(16);
  }
  name += path.extname(file);

  return name;
}

function generateNameWithVersion(file, version) {
  var extname = path.extname(file);
  return path.basename(file, extname) + "-" + version + extname;
}

Response is fulfilled before versions have generated

From #9:

The problem right now is, I did a kind of hack on function res.end, to let the server response as soon as possible, leaving the imagemagick process behind.

I've ran into an issue with this whereby I link to a "versioned" (resized) image immediately after the server responds, but as the image has yet to be resized, the image URL is broken.

The image resizing is done asynchronously from the upload of the original image. Perhaps we need to support a promise-like interface for this.

If knox gets timeout, node.js server process gets killed

If there is a timeout happened during S3 upload, a error thrown, we don't catch it anywhere, the whole server gets killed.

75783 ms - Mon, 26 Aug 2013 02:43:44 GMT - - - PUT /api/projects/52149046a1b7c9d84500003b curl/7.24.0 (x86_64-apple-darwin12.0) libcurl/7.24.0 OpenSSL/0.9.8x zlib/1.2.5 / -

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: read ECONNRESET
    at errnoException (net.js:901:11)
    at TCP.onread (net.js:556:19)

Test 'versions' property

danzi uses the req.files.[file].versions property to generate thumbnails.

I was looking to add a test (in tlvince@00fa2d2), but couldn't find a way to set the versions property using super{agent,test}#request.attach (manually adding it to the attachments property didn't work).

Is there a clean way to do this?

Support resizing on largest axis

Should be able to pass one axis, e.g. versions: { thumb: [10] } to resize width and allowing imagemagick to scale the height appropriately.

Consider changing the versions dimensions array to an object for clarity, e.g.:

versions: {
  thumb: {
    width: 100,
    height: 100
  }
}

Use SHA1 filenames?

How about using SHA1 (instead of a random) filenames? That way, we can prevent
duplication and save a write operation.

See: tlvince@e8fa3f6

(Untested with the AWS connector).

Handle multiple uploads

I think we need to add support for multiple uploads (feel free to correct me if this is already supported).

This comes in two forms: n uploads with different names, and n uploads with the same name (an array of uploads).

Here's a test stub: tlvince@d08c5fb

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.