Skip to content

Commit

Permalink
Bugfix
Browse files Browse the repository at this point in the history
Eliminated occasional double-slash in $cache_file path due to
$requested_uri sometimes starting with a /

Made created directories CHMOD 0755 instead of 0777
  • Loading branch information
MattWilcox committed Jan 24, 2012
1 parent 8c5d666 commit be3d3bc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
6 changes: 5 additions & 1 deletion adaptive-images.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/* PROJECT INFO --------------------------------------------------------------------------------------------------------
Version: 1.3.7
Version: 1.3.8
Changelog: http://adaptive-images.com/changelog.txt
Homepage: http://adaptive-images.com
Expand Down Expand Up @@ -240,6 +240,10 @@ function generateImage($source_file, $cache_file, $resolution) {
$resolution = $mobile_first ? min($resolutions) : max($resolutions);
}

/* if the requested URL starts with a slash, remove the slash */
if(substr($requested_uri, 0,1) == "/") {
$requested_uri = substr($requested_uri, 1);
}
$cache_file = $document_root."/$cache_path/$resolution/".$requested_uri;

/* Use the resolution value as a path variable and check to see if an image of the same name exists at that path */
Expand Down
6 changes: 6 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
version 1.3.8 (2012/01/24) ------------------------------------------------------------

BUG FIX
* Eliminated occasional double-slash in $cache_file path due to $requested_uri
sometimes starting with a /

version 1.3.7 (2011/11/21) ------------------------------------------------------------

BUG FIX
Expand Down

0 comments on commit be3d3bc

Please sign in to comment.