Code Monkey home page Code Monkey logo

image-resizer's People

Contributors

ernestopye avatar jgillman avatar jimmynicol avatar johnrees avatar jrowny avatar kbighorse avatar psugihara avatar wjordan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

image-resizer's Issues

Creating custom filters and sources

I would have thought creating a custom filter would be just copying an existing filter, like sepia.js into my own file located at /plugins/filters and changing the file to my needs. However this doesn't work due to that fact that gm module is not part of the image-resizer 'app' package.json and lives as a sub module of the image-resizer module inside of node_modules. How do I go about creating custom filters?

Request with malformed paths result in a crash

I made a request for an image on s3 with the following url. Note the missing hyphen from the path.
http://example.com/h200w200/media/doodle/image.jpg

Which causes sharp.resize to crash with a Error: Invalid height (1 to 16383) error.

Here's the full stacktrace and contents of my platform.js fle

I would have expected a 400 response. Do you think you can add some validation?

Also, it doesn't seem like errors here should crash the whole server. Is there some configuration setting I'm missing? Currently it's running in production mode.

Node is new to me but I'm willing to pitch in if needed. Just let me know how you think it ought to be handled.

Feature Request: disable sources

I know that most sources won't work without them being configured, but is there a way to disable sources other than deleting them from the sources folder in the node modules folder? I don't want someone to be able to serve/cache a youtube thumbnail behind our domain.

Thanks!

Original image request hangs

As mentioned in the 'sharp' pull request requesting the original image without any modifiers seems to hang.

For example, the request http://localhost:3003/test.png does not resolve until it either times out or the user kills the request in the browser. When that happens the following is output in the console/logs:

GET /test.png - - ms - -

ENOMEM and auto relauching

I have a workflow where a bulk of new images get uploaded to S3 at a time. This causes an spike in traffic to the server, and it's running out of memory..... I can sort of tolerate a crash, but I can't tolerate that gulp steps in and keeps the process running in a failed state.

I already have the process launched as a daemon in the server, so I don't really need gulp doing anything. I'm a bit confused how the call to env() in gulpfile.js sets the config correctly since it seems like all the vars seem to be pulled from environment_vars.js, at least in test.js. Is there a good way avoid using gulp and not store env vars in a repo?

Throws 500 when should be returning 404?

Hey,

I've noticed that if a request comes in for an image format that's not supported:

Image.validFormats = ['jpeg', 'jpg', 'gif', 'png'];

Image-Resizer will throw a 500 error. This seems like incorrect behaviour to me. If a document doesn't exist on S3, regardless of the extension shouldn't a 404 be returned?

If the document does exist, but is not a valid image format, then the service should return a 500.

I'd be interested to hear thoughts.

JPG image quality seems to be stuck at 80

This bit of code looks like it should be setting the quality, but when I check images that come out the other side their quality is always 80.

In my .env I have IMAGE_QUALITY set to 99. I'm using ImageMagick's identify utility to grab the image quality.

In my particular case the images are getting crushed in such a way that they really look terrible (probably have to click to see the full size):

compressed

identify: no identify

[resizer] new stream created! 
[resizer] s3 - 169ms
[resizer] identify: no identify 
[resizer] Error: spawn ENOENT 

Not very helpful output

Main file named test.js?

In my opinion we should rename test.js to server.js or app.js. It took me awhile to realize that test.js is the actual app used for production. I actually didn't realize it until I looked at the procfile.

Feature request: Add to modifers map

It'd be nice if I could add to the modifiers map/parse somehow so I could add arguments for custom filters, i.e. r for "rotate". r180 for example, would flip an image.

Error: Input buffer contains unsupported image format

I get this error when I try to resize a gif image, on heroku.

This seems to be related to sharp and libvips
lovell/sharp#162

The version used is later than the one they suggest.

I tried changing the .buildpack to get a newer libvips version but it still gave the same error.

Does anyone else have the same issue?

PS. Great work, extremely valuable project.

Update Sharp version requirement

Hello,

it seems like there is an issue with the version of Sharp required by this module. When I npm install Sharp package separately, it build fine, but when image-resizer tries to install it as a dependency, the build fails.

To install it, I had to modify the version of Sharp required by image-resizer package.json module in ~.npm cache.

http://localhost:3003/test-page no image

I tried to run your code locally but the test page does not show and image. E.g. I have no idea where:

http://localhost:3003/elocal/test/sample_images/image1.jpg

Is located. I am simply a little unsure how to configure the image repository? It is not clear to me how one uses this - e.g. where does the images come from. My hope was that I could supply it with a http url and it would do the resizing for me but it seems like i need som sort of repository?

Sharp doesn't work with vips 8.0.0+

I suspect this is something that Sharp would need to fix, but I'm not entirely clear if this is a problem with Sharp or a problem with image-resizer's integration with Sharp.

I updated vips with brew to the latest version (8.0.2) and afterwards got this error message when starting up the server:

module.js:355
  Module._extensions[extension](this, filename);
                               ^
Error: dlopen(/Users/jgillman/Code/myproject/node_modules/image-resizer/node_modules/sharp/build/Release/sharp.node, 1): Library not loaded: /usr/local/lib/$
ibvips.40.dylib
  Referenced from: /Users/jgillman/Code/myproject/node_modules/image-resizer/node_modules/sharp/build/Release/sharp.node
  Reason: image not found
    at Error (native)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/jgillman/Code/myproject/node_modules/image-resizer/node_modules/sharp/index.js:11:13)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/jgillman/Code/myproject/node_modules/image-resizer/src/streams/filters/blur.js:3:13)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)

Downgrade vips with brew

For anyone with the same problem, you can install the 7.42.3 version of vips with brew like so:

brew update
brew remove vips
cd /usr/local/Library
git checkout 6fc408b25a Taps/homebrew/homebrew-science/vips.rb
brew install homebrew/science/vips --with-webp --with-graphicsmagick

If you later need to install the most recent version you can reset your change:

brew remove vips
cd /usr/local/Library
git reset HEAD Taps/homebrew/homebrew-science/vips.rb
brew install homebrew/science/vips --with-webp --with-graphicsmagick

For reference, you can always check your vips version with vips --version.

The version you are installing from the code above this commit: https://github.com/Homebrew/homebrew-science/commit/6fc408b25a0c7f0afc4a978b5a1165b28175c629

local source crashes with "Error: write EPIPE"

I'm starting the server like this... and trying this url:

http://localhost:3001/h100-cfit/36/96/b236962m250800.2222230.original.gif

$ nodemon test.js
21 Aug 20:22:58 - [nodemon] v1.2.1
21 Aug 20:22:58 - [nodemon] to restart at any time, enter rs
21 Aug 20:22:58 - [nodemon] watching: .
21 Aug 20:22:58 - [nodemon] starting node test.js

events.js:72
throw er; // Unhandled 'error' event
^
Error: write EPIPE
at errnoException (net.js:904:11)
at Object.afterWrite (net.js:720:19)

404s when using a default source

So, I'm running into a small issue, which has fairly simple workarounds, but wanted to see if you had any input on this.

Basically, I'm storing images in different folders, and sometimes, the folder names might start with an "s." This causes that portion of the URL to be identifier as the modifier (square, happens with others too, "w", "h", etc), removing the folder from the "resolved" URL. This happens only when you have a default source defined, since you don't need to specify the modifiers in the URL. So for example:

Image stored in /samples/test.jpg, using the local source. I can request it just fine via:

/elocal/samples/test.jpg

but if i just do:

/samples/test.jpg

then it tries to read the image from /test.jpg, resulting in a 404.

There are 2 simple workarounds - always specifying the source, or simply adding an underscore prefix to the base folders. Wondering if you had any ideas on how we might be able to avoid this situation in a more elegant way.

not valid image format

I always get something like this:

GET /h50/images/logo.png 500 1012.759 ms - -
[resizer] new stream created!
[resizer] not valid image format

Image Resizer taking a long time with 'original'

I don't have time to fork at the moment, but when requesting an original image, it still streams through the resizer and it takes a very long time for large images. Some large images took 20+ seconds to load.

I added this code to line 21 of resize.js to resolve:

 if (image.modifiers.action === 'original'){
      image.log.log('resize: none requested');
      return callback(null, image);      
    }

JSON Metadata

Hey there, I'm trying to follow the example to pull some metadata out. I can hit a url to pull an image out of S3, but when I append .json to the end, I get an error.

Image request:

[resizer] new stream created! 
[resizer] s3 - 1440ms
[resizer] identify: no identify 
[resizer] resize - 760ms
[resizer] filter: none requested 
[resizer] optimize:jpg - 14ms
[resizer] original image size: 376.585kb 
[resizer] size saving: 96.76% 
[resizer] checksum a06c889fc5e4356bf4d1850f87cf85597c28e01b 

GET /s200/6flags.jpg 304 2382.848 ms - -

Metadata request

[resizer] new stream created! 
[resizer] s3 - 333ms
[resizer] AccessDenied: Access Denied 

GET /s200/image.jpg.json 500 336.641 ms - -

Any ideas?

Request Timeouts and hitting memory quota on Heroku (Memory leak?)

After running the app for a few hours on Heroku, we start seeing a ton of request timeouts, and eventually start using up a ton of memory on Heroku.

Aug 04 10:16:05 my_image_server heroku/router:  at=error code=H12 desc="Request timeout" method=GET path="/w352/eventFlyer/1437145123270-facb962019235ea60d67df94.jpg" host=my_image_server.herokuapp.com request_id=dd4ee711-bd31-4dbf-91c2-5b977bac94c7 fwd="SOME IP ADDRESS" dyno=web.1 connect=1ms service=30000ms status=503 bytes=0 
Aug 04 10:16:05 my_image_server heroku/router:  at=error code=H12 desc="Request timeout" method=GET path="/w352/eventFlyer/1437434594799-b4b4d128fb48871cc8a4ce87.jpg" host=my_image_server.herokuapp.com request_id=c67ed129-41e0-4afb-b1ed-92227e47e56f fwd="SOME IP ADDRESS" dyno=web.1 connect=2ms service=30000ms status=503 bytes=0 
Aug 04 10:16:07 my_image_server heroku/web.1:  Error R14 (Memory quota exceeded) 
Aug 04 10:16:07 my_image_server heroku/web.1:  Process running mem=2521M(492.4%) 
Aug 04 10:16:08 my_image_server heroku/router:  at=error code=H12 desc="Request timeout" method=GET path="/w900/eventFlyer/1437794831120-a15860af865d08c4d83b135d.jpg" host=my_image_server.herokuapp.com request_id=f360964f-dc4c-4c4b-ac03-86a6b69d03a3 fwd="SOME IP ADDRESS" dyno=web.1 connect=2ms service=30009ms status=503 bytes=0 
Aug 04 10:16:08 my_image_server heroku/router:  at=error code=H12 desc="Request timeout" method=GET path="/s80/eventFlyer/1438707312555-a8b1f5fee9d503055e010ae4.jpg" host=my_image_server.herokuapp.com request_id=87d14225-d945-4de9-9bf2-28792077e945 fwd="SOME IP ADDRESS" dyno=web.1 connect=13ms service=30005ms status=503 bytes=0  
Aug 04 10:16:08 my_image_server heroku/router:  at=error code=H12 desc="Request timeout" method=GET path="/w352/eventFlyer/1437794831120-a15860af865d08c4d83b135d.jpg" host=my_image_server.herokuapp.com request_id=e27688fe-0fa8-43a1-81b4-44593ee9742b fwd="SOME IP ADDRESS" dyno=web.1 connect=0ms service=30002ms status=503 bytes=0 

fn.apply(null, arr); TypeError: undefined is not a function

Hello,

Trying to get image-resizer working on Heroku with onthefly.js source

Had to add these to package.json dependencies:
"request": "",
"imagemin-gifsicle": "
"
(would be nice to have them added in the main repo)

Also had to use node 0.11 to avoid other npm errors, which were fixed in latest npm versions (the buildpack used the npm version bundled with node).

Now, accessing

myapp.herokuapp.com/h500/http://www.lonestardigital.com/Camera_Raw_Screenshots/DSC_0039_Jpeg_to_Jpeg_full_image.jpg

results in

2014-10-13T09:35:18.873754+00:00 app[web.1]: this.image  { error: null,
2014-10-13T09:35:18.873760+00:00 app[web.1]:   mark: 1413192918864,
2014-10-13T09:35:18.873762+00:00 app[web.1]:   format: 'jpg',
2014-10-13T09:35:18.873785+00:00 app[web.1]:   image: 'DSC_0039_Jpeg_to_Jpeg_full_image.jpg',
2014-10-13T09:35:18.873786+00:00 app[web.1]:   modifiers: 
2014-10-13T09:35:18.873787+00:00 app[web.1]:    { action: 'resize',
2014-10-13T09:35:18.873788+00:00 app[web.1]:      height: 500,
2014-10-13T09:35:18.873790+00:00 app[web.1]:      width: null,
2014-10-13T09:35:18.873791+00:00 app[web.1]:      gravity: 'c',
2014-10-13T09:35:18.873792+00:00 app[web.1]:      crop: 'fit' },
2014-10-13T09:35:18.873794+00:00 app[web.1]:   path: 'http://www.lonestardigital.com/Camera_Raw_Screenshots/DSC_0039_Jpeg_to_Jpeg_full_image.jpg',
2014-10-13T09:35:18.873795+00:00 app[web.1]:   contents: null,
2014-10-13T09:35:18.873796+00:00 app[web.1]:   originalContentLength: 0,
2014-10-13T09:35:18.873797+00:00 app[web.1]:   expiry: 7776000,
2014-10-13T09:35:18.873798+00:00 app[web.1]:   log: { queue: [ [Object] ], times: {}, queueLog: true } }
2014-10-13T09:35:27.066221+00:00 app[web.1]: /app/node_modules/image-resizer/node_modules/imagemin/node_modules/ware/lib/index.js:68
2014-10-13T09:35:27.066227+00:00 app[web.1]:     fn.apply(null, arr);
2014-10-13T09:35:27.066229+00:00 app[web.1]:        ^
2014-10-13T09:35:27.066231+00:00 app[web.1]: TypeError: undefined is not a function
2014-10-13T09:35:27.066232+00:00 app[web.1]:     at next [as _onTimeout] (/app/node_modules/image-resizer/node_modules/imagemin/node_modules/ware/lib/index.js:68:8)
2014-10-13T09:35:27.066234+00:00 app[web.1]:     at Timer.listOnTimeout (timers.js:133:15)
2014-10-13T09:35:27.080564+00:00 app[web.1]: Error waiting for process to terminate: No child processes

Thanks

Chalk missing from dependencies in Sharp branch

For pull #31:

I'm getting the following error with a totally fresh install and running gulp watch:

[gulp] [nodemon] starting `node index.js`
module.js:338
    throw err;
          ^
Error: Cannot find module 'chalk'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/jgillman/Code/pantograph/index.js:14:15)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3
[gulp] [nodemon] app crashed - waiting for file changes before starting...

Looks like chalk wasn't previously used in index.js. Adding it as a dependency in bin/image_resizer.js should solve it.

This does not crash the app when it's deployed to Heroku.

Constantly Missing from Cloudfront cache - possibly due to incorrect cache headers from image-resizer?

I've got my Cloudfront Cache Behavior settings to Use Origin Cache Headers from my Image Resizer origin. I however keep getting Misses from Cloudfront as if it's not caching the files correctly. I'm not sure if this is due to me sending the files to S3 originally with incorrect cache headers and image-resizer is just passing them on, or if I've configured image resizer incorrectly. Ideally I'd like to be able to set the cache expiry time in image resizer. I'm deployed to Heroku.

I've tried using IMAGE_EXPIRY node env (and setting to 7776000) and before also had the following code in my image servers index.js:

response.setHeader('Cache-Control', 'public, max-age=' + 6048000);

It seems that some images are Hits from Cloudfront, while many others are a Miss, even after refreshing the page multiple times, they still miss.

Last-Modified header is missing?

I might have something configured incorrectly but I'm not seeing Last-Modified being sent in the response.

Best case they're just missing and that's fine. Worst case it's missing and interpreted as Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT.


At the moment it seems to be screwing up Facebook's bot that grabs images for when a user shares a link. There is an open bug on Facebook where several users (including myself) are having image loading issues that look like they're related to the Last-Modified: Thu, 01 Jan 1970 00:00:00 GMT.

AllAccessDisabled: All access to this object has been disabled

I get this error from S3 I guess. Do you have any suggestion about how to solve this problem ?
I have all the rights to my bucket. Therefore I shouldn't have any issues regarding access.

I think that's why I get the following error :

GET /test/cr9YpNAdG.jpeg 500 643.251 ms - -
[resizer] new stream created!
[resizer] not valid image format

Unable to deploy to Heroku

I'm unable to deploy this app to Heroku. Here's what I'm doing.

git clone https://github.com/jimmynicol/image-resizer.git
cd image-resizer/
heroku create my-app
git push heroku master

Depending on whether I've set the BUILDPACK_URL environment variable, one of two things might happen:

  • If I have set the BUILDPACK_URL variable, the push fails with the error: "Push rejected, no Cedar-supported app detected."
  • If I have NOT set the BUILDPACK_URL variable, the push succeeds, but the app doesn't spin up any dynos. If I attempt to access the app at http://my-app.herokuapp.com, heroku logs tells me "No web process is running." Proceeding to set the BUILDPACK_URL variable at this point has no effect.

I'm new to Heroku, and probably making a noob mistake. Any help is greatly appreciated. Thank you!

Stream errors are not always handled or catchable

From my poking around I wasn't able to intercept any errors if there was a problem with the requested image. The most common situation is that an image is requested that doesn't exist and my logs are filling up with 500 errors :)

Personally, I would like to catch that error and return an appropriate default image.

I have two thoughts on how this could be accomplished:

  1. This could be done inside of image-resizer with an optional env var that defines a path to a default image to be used if the requested path doesn't have a valid image.
  2. Image-resizer could simply throw a catchable error and the user could add their own code to decide how to handle it. (e.g. serve a default image, throw some error code, etc.)

HTTP Pull?

Does this support pulling images from an HTTP server?

Building image resizer on windows

I've been having issues trying to build image-resizer on windows and deploy to Heroku.

The npm install instructions don't work for me. I get errors saying sharp is not supported on windows x64.

So instead I tried the following:

First I cloned the repository.

heroku create
heroku config:set NODE_ENV=development
heroku config:set BUILDPACK_URL=https://github.com/ddollar/heroku-buildpack-multi
heroku ps:scale web=1
git push heroku master

When I ran the push command I got an error stating that the .buildfile could not be found so I manually created it based on the template.
I then got an error regarding npm start when I tried to run again so I manually created the Procfile based on the template.
The when I run the push command it buillt correctly, but when I ran > heroku open and looked at the logs. I had the following errors:
module.js 338
throw: Err;
Error: Cannot find module 'app/bin/image-resizer.js'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Function.Module.runMain (module.js:501:10)

I realize now that this is because I never built image-resizer is there a way to do this on Heroku or something I am doing wrong in windows?

Make it possible to optimize image only, without applying other modifiers.

Hello,

right now it's not possible to only optimize the image. For example, if you only link to image using a q90 prefix, it will not return the image at all.

I'm not sure if this is intentional or not, but I think it makes sense to be able to only reduce the quality of the image without modifying it further?

Thanks

Image quality after resize

I have problems with quality of image after resize. Here are 3 images:

  1. resize with current 1.2.0 version, quality set to 100
    resize-v1 2 0
  2. resize with super old version (sep 2013), that used graphics magic library (quality also 100)
    image-using-graphicsmagic
  3. For comparison, resize done by PHP
    php-resize

This is the original image
original

Is there some quality configuration that I am missing?

Optimize error image is neither stream or buffer when request original file

I used to use this library with S3. After upgrading it to 0.10.1, if I request original file, it shows me error as following

index-0 (out): [resizer] new stream created!
index-0 (out): [resizer] s3 - 2308ms
index-0 (out): [resizer] identify: no identify
index-0 (out): [resizer] resize - 219ms
index-0 (out): [resizer] filter: none requested
index-0 (out): [resizer] optimize error image is neither stream or buffer
index-0 (out): [resizer] image is neither stream or buffer
index-0 (out): GET /c1315b4d-886f-4099-995a-e15ceb9100c3.png 500 2551.427 ms - -

The _isBuffer_ method of Image return false when requesting original file.
my Object.prototype.toString.call(this.contents.parent) is '[object undefined]', not sure what it is

Where are modified resources cached?

Hi,

thank you for this awesome library, had some troubles setting it up but eventually succeeded, it was well worth it :)

Since I am in the process of development, I am running this on a local server and I was wondering, are modified images saved anywhere (and later checked for their existence) or is that feature disabled for the local source?

Another thing, since I eventually plan on using s3 (will be my first time), you mention in your docs that images are no longer sent back to the S3 storage, but instead, and I quote, "The full power of the CDN is used for storing the modified images. This greatly improves performance both on the server side and client side.".

Could you maybe explain in a bit more details how are modified images stored when using S3, if they are not sent back to the server?

Thanks again for crafting this awesome library, appreciated :)

Error on Plain installation

On a plain installation, non Heroku, I am getting the following error, no matter if production/development or which source. this error also occurs for a simple test/sample_images/image1.jpg request.

the /env , /modifiers.json endpoints work fine

events.js:72
throw er; // Unhandled 'error' event               
^ Error: write EPIPE     
at errnoException (net.js:904:11)     
at Object.afterWrite (net.js:720:19)

App crashes on heroku cedar-14

First, thanks for the project! Set up went smoothly locally. Deploying to a new heroku stack, the app crashes on the following exception when attempting to process an image located on S3:

 2015-01-08T03:29:00.941788+00:00 app[web.1]:
 2015-01-08T03:29:00.941890+00:00 app[web.1]: events.js:72
 2015-01-08T03:29:00.942194+00:00 app[web.1]:         throw er; // Unhandled 'error' event
 2015-01-08T03:29:00.942204+00:00 app[web.1]:               ^
 2015-01-08T03:29:00.943546+00:00 app[web.1]:     at errnoException (net.js:905:11)
 2015-01-08T03:29:00.943543+00:00 app[web.1]: Error: write EPIPE
 2015-01-08T03:29:00.943547+00:00 app[web.1]:     at Object.afterWrite (net.js:721:19)
 2015-01-08T03:29:00.956264+00:00 heroku[router]: at=error code=H13 desc="Connection closed without response" method=GET path="/photos/xxx.jpeg" host=xxx.herokuapp.com request_id=4005667b-9566-48f3-8dbd-0be72fe997c3 fwd="66.65.172.88" dyno=web.1 connect=7ms service=163ms status=503 bytes=0
 2015-01-08T03:29:01.691755+00:00 heroku[web.1]: Process exited with status 8
 2015-01-08T03:29:01.707579+00:00 heroku[web.1]: State changed from up to crashed

I suspect this error is being raised during processing by graphicsmagick (similar exception to this issue aheckmann/gm#68) but I don't know enough yet to debug.

After switching to the deprecated cedar stack, heroku stack:set cedar and redeploying, images process and render just fine.

Let me know if you have ideas on how to debug or need more info.

Having issues pushing to Heroku

Had everything working fine previously but on doing minor changes and rebuilding and pushing to Heroku, Heroku is giving this error:

Sep 05 15:11:14 image-server heroku/slug-compiler:  Slug compilation started 
Sep 05 15:11:44 image-server heroku/slug-compiler:  Slug compilation finished 
Sep 05 15:11:44 image-server heroku/api:  Deploy d1e5126 by jgonzalez 
Sep 05 15:11:44 image-server heroku/api:  Release v46 created by jgonzalez 
Sep 05 15:11:44 image-server heroku/web.1:  State changed from crashed to starting 
Sep 05 15:11:46 image-server heroku/web.1:  Starting process with command `node index.js` 
Sep 05 15:11:47 image-server app/web.1:      throw err; 
Sep 05 15:11:47 image-server app/web.1:            ^ 
Sep 05 15:11:47 image-server app/web.1:  Error: Cannot find module 'imagemin-gifsicle' 
Sep 05 15:11:47 image-server app/web.1:      at Function.Module._resolveFilename (module.js:338:15) 
Sep 05 15:11:47 image-server app/web.1:      at Function.Module._load (module.js:280:25) 
Sep 05 15:11:47 image-server app/web.1:      at Module.require (module.js:364:17) 
Sep 05 15:11:47 image-server app/web.1:      at require (module.js:380:17) 
Sep 05 15:11:47 image-server app/web.1:      at Object.<anonymous> (/app/node_modules/image-resizer/node_modules/imagemin/index.js:170:27) 
Sep 05 15:11:47 image-server app/web.1:      at Module._compile (module.js:456:26) 
Sep 05 15:11:47 image-server app/web.1:      at Object.Module._extensions..js (module.js:474:10) 
Sep 05 15:11:48 image-server app/web.1:      at Module.load (module.js:356:32) 
Sep 05 15:11:48 image-server app/web.1:      at Function.Module._load (module.js:312:12) 
Sep 05 15:11:48 image-server app/web.1:      at Module.require (module.js:364:17) 
Sep 05 15:11:48 image-server app/web.1:  module.js:340 
Sep 05 15:11:48 image-server heroku/web.1:  Process exited with status 8 
Sep 05 15:11:49 image-server heroku/web.1:  State changed from starting to crashed 

Even tried creating a new Heroku app, adding same environment variables that previously worked and trying to deploy again - same issue and error message on new Heroku server as well. I think this issue might have something to do with NPM or the NPM that heroku is using but not sure. Rolling back to before I made any change and everything works fine. Probably not technically an issue with this module/app but it affects deploying it to Heroku

App crashes whenever image is not found

Hi,

Testing 1.0 on both localhost and heroku..
It seems that the app creashes whenever an image is not found.

I have only tested twitter and facebook for now and getting this error:

/home/ubuntu/workspace/projects/image.server/node_modules/image-resizer/node_modules/map-stream/index.js:103
        throw err
              ^
Error: Buffer contains an unsupported image format. JPEG, PNG, WebP and TIFF are currently supported.
    at new Sharp (/home/ubuntu/workspace/projects/image.server/node_modules/image-resizer/node_modules/sharp/index.js:81:13)
    at Sharp (/home/ubuntu/workspace/projects/image.server/node_modules/image-resizer/node_modules/sharp/index.js:16:12)
    at /home/ubuntu/workspace/projects/image.server/node_modules/image-resizer/src/streams/resize.js:44:13
    at wrappedMapper (/home/ubuntu/workspace/projects/image.server/node_modules/image-resizer/node_modules/map-stream/index.js:84:19)
    at Stream.stream.write (/home/ubuntu/workspace/projects/image.server/node_modules/image-resizer/node_modules/map-stream/index.js:96:21)
    at Stream.ondata (stream.js:51:26)
    at Stream.emit (events.js:95:17)
    at queueData (/home/ubuntu/workspace/projects/image.server/node_modules/image-resizer/node_modules/map-stream/index.js:43:21)
    at next (/home/ubuntu/workspace/projects/image.server/node_modules/image-resizer/node_modules/map-stream/index.js:71:7)
    at /home/ubuntu/workspace/projects/image.server/node_modules/image-resizer/node_modules/map-stream/index.js:85:7
    at /home/ubuntu/workspace/projects/image.server/node_modules/image-resizer/src/streams/identify.js:17:14
    at wrappedMapper (/home/ubuntu/workspace/projects/image.server/node_modules/image-resizer/node_modules/map-stream/index.js:84:19)
    at Stream.stream.write (/home/ubuntu/workspace/projects/image.server/node_modules/image-resizer/node_modules/map-stream/index.js:96:21)
    at write (_stream_readable.js:602:24)
    at flow (_stream_readable.js:611:7)
    at Facebook.pipeOnReadable (_stream_readable.js:643:5)

... same error if I call for a twitter profile image that is not found.

Could this be related to #46?

Feature: Content Types

Currently, the image-resizer only allows files that have a white-listed file extension (jpg, png, etc.) However, many image hosts ignore file extensions. As an example, here's a video from popular video host Ooyala:

http://ec.c.ooyala.com/Fpbzl1dTo65q-IuenkPBkqSLXlbKFYAz/3Gduepif0T1UGY8H4xMDoxOjBzMTt2bJ

The image resizer should probably not check file extension on a request, rather, it should check the content type of the response and pass it to the various filters.

Further, it would great if we could change the type within a filter. For example:

module.exports = function(image, callback) {

  // create the sharp object
  var r = sharp(image.contents);

  // apply the filter and pass on the stream
  r.toFormat(sharp.format.png).stream(callback);
};

Feature Request: named configurations

I think it'd be nice to be able to name a configuration, i.e

{thumbnail: 's100-gne'}

Now instead of calling modifiers I can call the thumbnail path. This has two advantages:

  1. More semantic name
  2. If you add an option to ONLY allow named configurations, then you disrupt the ability for a DDOS attack to flood your server/CDN with randomly filtered/sized images.

Just an idea.

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.