Create a plugin to add metadata to http response headers
Preface: I'm an iOS developer who builds some apps against sites that use ImageResizer.
I have a common use case where it would be helpful to know the original size of an image at the point when the processed image is returned.
I often grab thumbnails to show in tables in the iPhone. When a user clicks on a table cell, I load up a custom view. Without knowing the full size of the image, I have to delay doing my view layout until I can download the full image. This can be a bit slow on some phones. If I knew the height/width of the original image, I could do my client side layout and then show the image when it finishes downloading.
If I could get the original height and width of an image as custom http response headers, it would allow me to change my client side behavior and make things more efficient.
Is this something that would be easy to implement as a Plugin? I could see it being a bit more complicated if caching is involved.
-
I don't know if you could make it work through a CDN, but take a look at the ClientCache plugin in /Core/Plugins/Basic/ to see how to add headers to both cached and uncached responses. To get the original size info, you can inherit from BuilderExtension and hook into the PrepareSourceBitmap event. You may need to store the data in HttpContext.Items to communicate across those stages, though.