Hi,<p>Firstly, the link to the tool - <a href="https://github.com/DrRoach/DynamicImage" rel="nofollow">https://github.com/DrRoach/DynamicImage</a><p>I created a dynamic image sizing tool that allows images of any size to be generated on the fly. It's aims are as follows:<p>a) Allow users of sites to upload images of any size without the site owner having to worry about their dimensions or having to resize them.<p>b) Reduce load times for sites as images can be stored on their own dedicated server and be served in milliseconds.<p>I'd love to hear some feedback as to what you think and whether you'd consider using this tool and if not, why not?<p>All constructive criticism is welcome!
Thumbor is an awesome open source solution which has proved itself in many high traffic sites.<p><a href="https://github.com/thumbor/thumbor" rel="nofollow">https://github.com/thumbor/thumbor</a>
Nice! This is definitely an important tool when creating a site traffic in images to be displayed across a variety different sized screens. Having worked on this type of project before I'll mention a few challenges you have not yet addressed.<p>At some scale point, your single DynamicServer server will have more resize requests than it has CPU cycles to serve. The straightforward solution will be to add more DynamicServer instances. This means that your source image directory will have to be accessible from both instances. It also duplicates your cache directory, meaning a single image size could get generated on both servers. You might solve that by having a shared image cache network directory. Another solution could be to use a hash mechanism to determine a particular backend server from the load balancing layer, so any particular image would always be generated on the same instance.<p>Something interesting happens when people upload an image to their newsfeed. If it's a public newsfeed, there can be a good many requests of the image within the next several seconds at upload. This means that you can get multiple cache miss requests at the same time coming into your DynamicImage server. Your PHP processes are vertically partitioned, so your server will be simultaneously generating the resize. For users with only a few friends, this is a small waste of CPU cycles, but for users with massive user bases (e.g. Britany Spears), a single upload could grind your DynamicImage server to a halt just because of simultaneous duplicated work. Varnish (and other load balancers) can solve this by collapsing multiple requests to the same resource into a single HTTP call (<a href="https://varnish-cache.org/docs/3.0/tutorial/handling_misbehaving_servers.html" rel="nofollow">https://varnish-cache.org/docs/3.0/tutorial/handling_misbeha...</a>).
I've created scripts like these as part of our home-brewed CMS system in the early 2000's.<p>Nice and easy dos tool. Enumerate the width and height parameters and bring down the server fast.<p>Better way to do it is to specify, or allow admins to specify, a set of named sizes and only allow these named sizes.<p>You could also think about adding parameters to determine the crop, or force aspect ratio etc. (with the same risk of dos)
Nginx has a module for this which you can tie into your cache: <a href="http://charlesleifer.com/blog/nginx-a-caching-thumbnailing-reverse-proxying-image-server-/" rel="nofollow">http://charlesleifer.com/blog/nginx-a-caching-thumbnailing-r...</a>
I was playing around with some image optimization libraries a few weeks ago. This looks handy, but my wish list also includes image optimizations to reduce file size.
imgix is an image CDN service (not free) that offers this feature and more. Not usually used for personal projects I guess since there is no free tier for it.