Permalink
Browse files

Updated and classed-up the readme.

  • Loading branch information...
1 parent e228db6 commit fd5b6190bcbd4f093f6099ffec19c9a96e1038f7 @Wilto committed May 17, 2011
Showing with 16 additions and 8 deletions.
  1. +1 −4 images/img.php
  2. +15 −4 readme
View
5 images/img.php
@@ -76,11 +76,8 @@ function resize($target, $path, $view, $type) {
$image = $rwd->resize($image, $path, $view, $type);
}
- header("Cache-Control: private, max-age=10800, pre-check=10800");
- header("Pragma: private");
- header("Expires: " . date(DATE_RFC822, strtotime(" 2 day")));
+
header("Content-Type: image/$type");
-
print $image;
imagedestroy($image);
?>
View
19 readme
@@ -1,7 +1,18 @@
-Spent today messin’ around with responsive images, and thought I might try a back-end approach—it actually started to look kind of promising, so I may as well throw my scratch paper up here, yeah?
+Calland — Responsive Images
+============================
-So, the basic idea is that the .htaccess file intercepts the request for the image file and forwards the path along to img.php, which potentially generates and caches a smaller version of the image depending on the screen size set in the ‘rwd-viewport’ cookie via JS.
+Just wanted to experiment with a seamless approach to responsive images. Which is to say “the src points to the image as usual, and all the magic happens behind the scenes.”
-Said cookie is set to the greater of the device's height or width, to allow for full-bleed images regardless of device orientation.
+So, the basic idea is that the .htaccess file intercepts the request for the image file and forwards the path along to img.php, which potentially generates a smaller version of the image depending on the screen size set in the ‘rwd-viewport’ cookie. As this is set in the document’s head, it’s available to scripts invoked in the document’s body on initial load.
-Here's the big thing: I'm not sure how I feel about delivering the mobile images to users with cookies disabled. Granted it's a better approach than potentially throwing monster images at users on a Nokia 6230, but... Still, there has to be some way of providing a fall-back method for passing the viewport information along to the backend.
+Said cookie is set to the greater of the device’s height or width, allowing for full-bleed images regardless of device orientation.
+
+## What I Don't Like
+
+# There's nothing going on (yet) in the way of caching the generated images.
+# The lack of control. One doesn’t always need potentially screen-width images, so I want to introduce some way of controlling this on a image-specific level.
+# Everything hinges on cookies and JS being enabled. Again, I’m just messing around with this, and haven’t come up with anything in the way of a plan-B—I wouldn’t use this for any production sites yet.
+
+## What I Do Like
+
+# The name is kind of clever, right? Eh, eh?

0 comments on commit fd5b619

Please sign in to comment.