I wonder why are there so many services that work with this kind of business model. while I would be willing to pay for code I can own, I would never invest in something in something where I can't predict it's future.
I can't speak specifically about this responsive image feature, but as for imgix's core business, I have mixed feelings. It's pretty trivial to write on-the-fly image processing using an existing graphics library. And given that the image can be cached and served from disk and a CDN, it can scale incredibly well. Having said that, the features that they support is impressive, the API is intuitive, the speed is great,…
Show HN: Imgix.js, a JavaScript library for responsive imaging
11–20 of 33 posts
Re: Show HN: Imgix.js, a JavaScript library for responsive imaging
#12Earlier quoted context omitted.
I can't speak specifically about this responsive image feature, but as for imgix's core business, I have mixed feelings. It's pretty trivial to write on-the-fly image processing using an existing graphics library. And given that the image can be cached and served from disk and a CDN, it can scale incredibly well. Having said that, the features that they support is impressive, the API is intuitive, the speed is great,…
I just had to write an image server for work and found it incredibly hard. What's your on-the-fly image processing setup look like?
The second part was a bit more "fancy". There were two really slow parts to this (a) fetching the origin (from S3) and (b) applying lossless compression (for a large image, it can take 10+ seconds). Fetching from origin is easily solved by caching the origin to disk. So if you ask for goku.png?w=90001&h=9001 and then goku.png?w=2393&h=43433 it's only going to be 1 origin fetch. For the lossless compression, we just used the filesystem as a queue. We'll serve up the umcompressed image with a short cache header (maybe 10 minutes) and store it in /storage/uncompressed. The filesystem is monitored and when a file is added, we compress it and them move it to /storage/compressed.
So, when you serve an image, the flow is:
- check for the file in /storage/compressed/ and serve that with a long cache header (this is a fully transformed image (hash the querystring parameters))
- check for the file in /storage/uncompressed/ and serve that with a short cache header (this is a fully transformed image (hash the querystring parameters))
- Check if we at least have the original in /storage/original
- if not, fetch the original, put it in /storage/original
- Transform the image, store it at /storage/uncompressed and serve it up- In the background, compress images and move them from /storage/uncompressed to /storage/compressed
It might seem like overkill when you consider that, despite serving thousands of images per second, the CDN handles almost every request. The problem is with the lossless compression. We found it impossible to do it on-the-fly for too many of our images, so you absolutely need that available and ready to go for the 5% CDN miss.
Re: Show HN: Imgix.js, a JavaScript library for responsive imaging
#13Earlier quoted context omitted.
There is nothing stopping you from setting the src tag. But you are just adding another request. Our base service works perfectly with src set and picturefill. This library is for cases where a different result is desired.
Why isn't there an img-tag in the default example? Why are you promoting bad practice by not having images in img-tags? You solved one problem but created a much bigger problem. Bots, screen readers and non-javascript client should see an image, not a div with some attributes.
Re: Show HN: Imgix.js, a JavaScript library for responsive imaging
#14Earlier quoted context omitted.
Why isn't there an img-tag in the default example? Why are you promoting bad practice by not having images in img-tags? You solved one problem but created a much bigger problem. Bots, screen readers and non-javascript client should see an image, not a div with some attributes.
They're welcome to target whichever type of users they want to - it's 2014, most average internet users have javascript enabled. Besides, you can add a title/aria-* attribute for bots and screenreaders (perhaps not semantically correct but gets the job done).
Re: Show HN: Imgix.js, a JavaScript library for responsive imaging
#15Re: Show HN: Imgix.js, a JavaScript library for responsive imaging
#16Earlier quoted context omitted.
I just had to write an image server for work and found it incredibly hard. What's your on-the-fly image processing setup look like?
I'd break it down into two parts. The first is the image transformation. For this we use graphics magic, and based on the params in the querystring, we'd crop, resize, alter the quality, anchor the image to a focus point and so on. Not copy and pastable, but [1] should give you a rough idea. Also [2] is code we use to get the file type and size of the image (gm identify can be painfully slow). The second part was a b…
Do you handle the malicious case of someone supplying various widths and heights potentially DoSing the server?
Re: Show HN: Imgix.js, a JavaScript library for responsive imaging
#17Earlier quoted context omitted.
I can't speak specifically about this responsive image feature, but as for imgix's core business, I have mixed feelings. It's pretty trivial to write on-the-fly image processing using an existing graphics library. And given that the image can be cached and served from disk and a CDN, it can scale incredibly well. Having said that, the features that they support is impressive, the API is intuitive, the speed is great,…
I just had to write an image server for work and found it incredibly hard. What's your on-the-fly image processing setup look like?
Nginx to handle existing files. Python + Pillow + cherrypy (or could be any other microframework) to handle image processing on the fly and then caching processed image to the disk.
All in all around 350 lines of code in python. And something like 100 lines in nginx (because of a heavy filename processing and inner url rewriting).
Result - facebook-like image processing:
Simple resize: http://media.example.com/w400x200/id_token_string.jpg Crop (based on coords): http://media.example.com/20.20.380.300/id_token_string.jpg Or crop resize from center: http://media.example.com/c200x200/id_token_string.jpg
and so on...
Fun project.
Re: Show HN: Imgix.js, a JavaScript library for responsive imaging
#18Earlier quoted context omitted.
I'd break it down into two parts. The first is the image transformation. For this we use graphics magic, and based on the params in the querystring, we'd crop, resize, alter the quality, anchor the image to a focus point and so on. Not copy and pastable, but [1] should give you a rough idea. Also [2] is code we use to get the file type and size of the image (gm identify can be painfully slow). The second part was a b…
Are you using S3 with multiple EC2 instances/multiple servers? Do you keep your /storage/ on S3? I'm considering pulling from S3, then resizing on whatever server it is, then storing back on S3 - any issues with that? Do you handle the malicious case of someone supplying various widths and heights potentially DoSing the server?
Whether storing it back on S3 is "good enough" depends on whether you feel the latency to fetch from S3 is acceptable. I don't have any hard numbers (I might have at some point). I imagine you'll see a percentage in the 1-4s range, which is pretty bad considering you still have to serve it to the CDN and then the CDN to the user. If you have users on mobile or in developer countries, you do what you can to make your side as fast as possible.
Never had malicious users, but we worried about it. We took a reactive approach: monitoring disk space usage. It never proved necessary to do more. You're definitely open to a DOS attack. Hard to mitigate too...can't rate limit since the request comes from the CDN. You could whitelist certain dimensions, but we also allowed our content owners to specify the focal point of the image, which we'd center our crop on, which means any value of x and y is reasonable. You could possibly store that data on the image servers, instead of passing it in the querystring, but then you're introducing state and, with multiple servers, synchronisation. shudder.
You can see it in action at:
http://0.viki.io/viki.jpg?s=263x220&q=h
with documentation at:
http://dev.viki.com/v4/images/
(the [q]uality argument isn't documented, weird....unless you specify a quality (I only remember [h]igh) we pick a jpg compression based on the filesize)
Re: Show HN: Imgix.js, a JavaScript library for responsive imaging
#19Earlier quoted context omitted.
I just had to write an image server for work and found it incredibly hard. What's your on-the-fly image processing setup look like?
Had to write image server myself and it wasn't really hard. Nginx to handle existing files. Python + Pillow + cherrypy (or could be any other microframework) to handle image processing on the fly and then caching processed image to the disk. All in all around 350 lines of code in python. And something like 100 lines in nginx (because of a heavy filename processing and inner url rewriting). Result - facebook-like imag…
A: Imgix = cost of imgix subscription + integration time * hourly rate (it's dead simple)
B: Rolling your own = dev time * hourly rate + maintenance/ops time * hourly rate
For most orgs B > A. For most individual programmers since hourly rate is not a factor A < B.
Re: Show HN: Imgix.js, a JavaScript library for responsive imaging
#20What would the advantage of this be versus using the picture tag with your own image sources hosted on a CDN? (Let's assume picture tag is widely supported for now)