jimmynicol / image-resizer Goto Github PK
View Code? Open in Web Editor NEWOn-the-fly image resizing using Node.js and GraphicsMagick. Heroku Ready!
License: MIT License
On-the-fly image resizing using Node.js and GraphicsMagick. Heroku Ready!
License: MIT License
Is there any way to control the level of jpeg compression for generated images?
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?
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.
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!
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 - -
In readme, there is a reference to env variable: SOCIAL_IMAGE_EXPIRY, but when investigating source code for facebook plugin (https://github.com/jimmynicol/image-resizer/blob/master/src/streams/sources/facebook.js#L26), I see that image expiry is set to env variable IMAGE_EXPIRY_SHORT which means SOCIAL_IMAGE_EXPIRY is not used anywhere in the code.. am I correct?
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?
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.
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):
[resizer] new stream created!
[resizer] s3 - 169ms
[resizer] identify: no identify
[resizer] Error: spawn ENOENT
Not very helpful output
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.
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.
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.
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.
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?
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)
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
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)
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.
I always get something like this:
GET /h50/images/logo.png 500 1012.759 ms - - [resizer] new stream created! [resizer] not valid image format
Hello,
Would it be possible to make this work same as http://www.sencha.com/learn/how-to-use-src-sencha-io/ ?
That is, accessing
http://my-deploy.herokuapp.com/h500/http://whatever.com/image.jpg
will render the image from whatever.com at 500px.
I'm confused by required Amazon credentials (minimum required variables). They should be optional, unless one enables cache storage with Amazon.
Thanks
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);
}
Just a mixup with request
and response
. Happens to me all the time ๐, they both start with re-
!
Details here: 2bfb2c8#commitcomment-9755749
Hey @jimmynicol just gave this a shot, and wanted to let you know that the plugin directory isn't being created automatically.
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?
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
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
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.
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.
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
.
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
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:
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!
It'd be great if there were a way to invalidate the CDN in the event of a new image being posted.
This is basically the same issue as #20 - but now with sharp instead of GM - We need Sharp to be loaded in package.json so that plugins can use sharp module to create custom filters.
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:
Does this support pulling images from an HTTP server?
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?
It seems that when a facebook name has dots (firstname.lastname), only the part before dot (firstname) is used.
Took at quick look at the code, and the bug is here: https://github.com/jimmynicol/image-resizer/blob/master/src/streams/sources/facebook.js#L46
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
I have problems with quality of image after resize. Here are 3 images:
Is there some quality configuration that I am missing?
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
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 :)
example url cdn.example.com/w500/test/image.jpg.json
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)
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.
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
Getting and setting the content type on the response would be nice.
To build sharp, "GCC version 4.6+ is required". The outdated Cedar-10 stack has GCC 4.4 only. Heroku apps must update to the Cedar-14 stack to use the newer version of image-resizer that user sharp instead of GM. Readme should be updated to detail this required change.
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?
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);
};
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:
Just an idea.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.