Permalink
Browse files

Various updates

  • Loading branch information...
1 parent 8e03f9d commit 8cd085a84200b0165f4152ac88aa5d26c0a7eae7 @MattWilcox committed Nov 10, 2011
Showing with 22 additions and 5 deletions.
  1. +4 −0 .htaccess
  2. +6 −5 adaptive-images.php
  3. +12 −0 changelog.txt
View
@@ -9,9 +9,13 @@
# RewriteCond %{REQUEST_URI} !and-ignore-this-directory-too
RewriteCond %{REQUEST_URI} !assets
+
+ # don't apply the AI behaviour to images inside AI's cache folder:
+ RewriteCond %{REQUEST_URI} !ai-cache
# Send any GIF, JPG, or PNG request that IS NOT stored inside one of the above directories
# to adaptive-images.php so we can select appropriately sized versions
+
RewriteRule \.(?:jpe?g|gif|png)$ adaptive-images.php
# END Adaptive-Images -------------------------------------------------------------------------------
View
@@ -18,7 +18,7 @@
$sharpen = TRUE; // Shrinking images can blur details, perform a sharpen on re-scaled images?
$watch_cache = TRUE; // check that the responsive image isn't stale (ensures updated source images are re-cached)
$browser_cache = 60*60*24*7; // How long the BROWSER cache should last (seconds, minutes, hours, days. 7days by default)
-$mobile_first = TRUE; // If there's no cookie sends the mobile version (if FALSE, sends largest $resolutions version)
+$mobile_first = FALSE; // If there's no cookie sends the largest $resolutions version (if TRUE, sends smallest)
/* END CONFIG ----------------------------------------------------------------------------------------------------------
------------------------ Don't edit anything after this line unless you know what you're doing -------------------------
@@ -161,12 +161,13 @@ function generateImage($source_file, $cache_file, $resolution) {
ImageDestroy($src);
// sharpen the image?
- if ($sharpen == TRUE) {
+ // NOTE: requires PHP compiled with the bundled version of GD (see http://php.net/manual/en/function.imageconvolution.php)
+ if($sharpen == TRUE && function_exists('imageconvolution')) {
$intSharpness = findSharp($width, $new_width);
$arrMatrix = array(
- array(-1, -2, -1),
- array(-2, $intSharpness + 12, -2),
- array(-1, -2, -1)
+ array(-1, -2, -1),
+ array(-2, $intSharpness + 12, -2),
+ array(-1, -2, -1)
);
imageconvolution($dst, $arrMatrix, $intSharpness, 0);
}
View
@@ -1,3 +1,15 @@
+version 1.3.4 (2011/11/10) ------------------------------------------------------------
+
+ BUG FIXES
+ * The sharpening function broke on libraries not compiled with the bundled version
+ of PHP. It now tests the imageconvolution function is available and gracefully
+ handles cases where it isn't.
+
+ NOTES
+ * Set $mobile_first to default to FALSE. Browsers are inconsistent with their
+ ability to set cookies before requesting <img>s. For more information visit
+ http://blog.yoav.ws/2011/09/Preloaders-cookies-and-race-conditions
+
version 1.3.3 (2011/10/18) ------------------------------------------------------------
BUG FIXES

0 comments on commit 8cd085a

Please sign in to comment.