tripviss / image-resizer Goto Github PK
View Code? Open in Web Editor NEWOn-the-fly image resizing using Node.js and libvips. Heroku Ready!
License: MIT License
On-the-fly image resizing using Node.js and libvips. Heroku Ready!
License: MIT License
My NODE_ENV was set to "dev" and thus produced a not-so-obvious error in heroku
Error: Cannot find module './src/config/dev'
^ that did not mean too much to me initially.
The stack trace was even less informative then that. I suggest a try catch with a message about what valid values the NODE_ENV can be set to... and perhaps it could default to using the development.js file with a warning if no matching file can be found.
Thanks!
I've edit the environment to include
EXTERNAL_SOURCE_VF='http://www.cfmedia.vfmleonardo.com/'
However, whenever I try loading an image, i got 500 error, The specified key does not exist.
(looks like the original is on cloudfront/s3).
mydomain.com/evf/imageRepo/4/0/55/359/440/ROY.44A_H.jpg
Example of said image url: http://www.cfmedia.vfmleonardo.com/imageRepo/4/0/55/359/440/ROY.44A_H.jpg
I do not have control over this image / url.
Sharp returns a "Bad extract area" when extracting "out of bounds" portions of images. This means that requesting a bad cut makes the server return a 500 code. This is not really ideal for a production environment.
Wouldn't it be better to simply return a sensible default (like ignoring the crop or switching to a different crop mode) while issuing a 400 (as in a "Bad request" was made)?
There is no way to specify the output format since the current parsing requires the input format extension before it (e.g. .jpg.webp
).
A path like http://my.cdn.com/h-w/path/to/image.png will crash the app. It should send the original image size, or an error but no crash the app.
Thanks for this fork! It's great!
Is there an easy way to set an external source (public read only access to an Azure blob storage location in my case) as the DEFAULT_SOURCE
?
I currently have have an environment EXTERNAL_SOURCE_FOO = "https://mylocation.blob.core.windows.net"
and this works great but that means I would need to append efoo
at the front of every url like http://localhost/efoo/path/to/my/photo.png
I tried modify DEFAULT_SOURCE = S3
to DEFAULT_SOURCE = FOO
but visiting http://localhost/path/to/my/photo.png
doesn't work
Is it possible to disable logging?
Hey @teohhanhui,
Good job on this fork ! It looks like https://github.com/jimmynicol/image-resizer isn't maintained anymore..
I just wanted to get some feedback from you about this library, are you using it in production ?
Any issue known about using it ?
I'm still wondering if I should use on the fly resize with image-resizer
or use AWS lambda
to automatically convert my images.
Would appreciate some of your wisdom :)
Thanks
When i'm trying to deploy on heroku i'm getting like
Application error
what is problem please help me
image-resizer_1 | [resizer] new stream created!
image-resizer_1 | [resizer] s3 - 80ms
image-resizer_1 | [resizer] identify: no identify
image-resizer_1 | [resizer] resize error Error: Unsupported output format gif
image-resizer_1 | [resizer] resize - 15ms
image-resizer_1 | [resizer] Error: Unsupported output format gif
image-resizer_1 | GET /h126-w225-cfill/02cc194d-25dc-4f36-b09b-8772c56b6ffb.gif.webp 500 115.418 ms - -
The bug:
A call to http://<url>/some/path/cistf72.jpg
works fine.
A call to http://<url>/cistf72.jpg
does not.
Some investigating revealed that the parse
method in modifiers.js
calls parseModifiers
even when no path is provided. Since the first letter of the filename above is a modifier, it will set the hasModStr
variable to true, which in turn cases trouble in image.js
.
The end result is that images that (1) are in the root path and (2) start with a filename w/modifier string can never be retrieved by original.
Just wondering if this should be working or not but I've added a 404 picture that I'd like to return in the requested size.
Should that technically be working as I only receive my original size.
Would be great if that would work!
Because we're stripping all meta data, it would be a good idea to rotate the image to correct orientation before stripping it, wouldn't it?
It would be very useful to be able to set the user-agent for external sources. Since image-resizer doesn't forward the query parameters and it's best used on Heroku (where there is no fix IP), it's not easy to know on the origin "who" called and make the difference between legitimate and non legitimate calls for example.
SOMETHING.png.webp
ends up fetching something.png
from the source.
Fixed by this preliminary patch: beijaflor-io@73c489f
I have an image which is jpg but somehow when i use external source to resize it, I got Unsupported output format "gif"
The image url is
http://pix3.agoda.net/hotelimages/694/69405/69405_14040308360018949836.jpg?s=312x
env EXTERNAL_SOURCE_TEST='http://pix3.agoda.net
and access it via
example.com/etest/hotelimages/694/69405/69405_14040308360018949836.jpg?s=312x
e.g. https://avatars2.githubusercontent.com/u/548843?v=3&s=96
The query string is not passed on to the source, as the source url is not properly URL-encoded.
Fixing this would introduce a BC break. (We cannot just blindly perform URL decode, as we risk double decoding...) Should the requirement to URL encode be applied to all sources, or should it be configurable per source?
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.