Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 282 lines (209 sloc) 13 KB
version 1.5.2 (2012/04/16) ------------------------------------------------------------
* AI was not generating high DPI images larger than the existing maximum
$resolutions value
I used a < when I needed a >. That is now fixed. If AI detects retina displays it
is now able to generate larger images than the top bounds set in $resolutions.
version 1.5.1 (2012/04/14) ------------------------------------------------------------
* JPGs are now created as Progressive rather than Optimised.
Progressive JPGs are actually slightly smaller in file-size than Optimised JPGs,
and have the benefit of appearing to load faster in modern browsers (they
download in passes, gradually getting sharper).
version 1.5 (2012/04/14) --------------------------------------------------------------
* Much improved support for Retina and other high DPI devices
NOTE: Retina support requires using alternate JavaScript:
<script>document.cookie='resolution='+Math.max(screen.width,screen.height)+("devicePixelRatio" in window ? ","+devicePixelRatio : ",1")+'; path=/';</script>
NOTE: If you see folders in the ai-cache directory which are *larger* than any
defined in your $resolutions array, it is because someone with a high DPI / Retina
display visited your site, and AI was able to generate the required image for them.
Previous AI behaviour meant that supporting Retina required adding very high values
in the $resolutions array. This is sub-optimal because:
1) This array is meant to be nothing more than the same values as your media query
breakpoints. Adding larger ones isn't intuitive.
2) When no cookie is set, AI sends non-mobile devices the largest $resolution value,
which in that case could be far too large for most people (2000px+)
AI is now much smarter, you do not need to edit the $resolutions array; just leave
that as your CSS MQ sizes.
AI now auto-detects the pixel density of any high DPI device and either picks a
matching size from the existing array, or creates new high-dpi images which are
multiples of your chosen $resolutions values.
version 1.4.1 (2012/03/28) ------------------------------------------------------------
* More helpful error messages if something goes wrong.
* Updated the documentation a little.
version 1.4 (2012/02/19) --------------------------------------------------------------
* Auto-creates the cache folder with the correct permissions.
No need to manually create the ai-cache folder any more, AI does it for you.
* Fixed an incorrect permission on created files, they're now 755 not 777.
version 1.3.9 (2012/02/17) ------------------------------------------------------------
Thanks to Gerv
* Better detection of mobile device in the event cookies are not available.
If cookies are unavailable AI resorts to basic UA sniffing.
Previously AI assumed all devices are mobile and searched the UA string for a
desktop OS. If found it overrode $mobile_first. However, this meant tablet
devices got mobile sized images as their OS is not a desktop OS.
Now switched to assume the device is a desktop, but AI searches the UA string for
'mobile' to switch to mobile first. All current mobile browsers behave in this
way, meaning mobiles still get mobile resolution, but tablets and desktop get
the largest configured resolution.
* Removed $mobile_first as it is no longer needed (see above)
version 1.3.8 (2012/01/24) ------------------------------------------------------------
* Eliminated occasional double-slash in $cache_file path due to $requested_uri
sometimes starting with a /
version 1.3.7 (2011/11/21) ------------------------------------------------------------
* A stupid mistake was causing the browser detect to always return false.
This has been fixed.
With this update Adaptive Images now detects if a user is running on a desktop OS
and switches $mobile_first to FALSE in that case. This means that if no cookie is
set and $mobile_first is TRUE the following will happen:
On a mobile phone, the mobile sized image will be delivered.
On a desktop, the highest resolution configured will be delivered.
If a cookie is set, Adaptive Images will use the cookie value to determine the
correct size image to send.
version 1.3.6 (2011/11/11) ------------------------------------------------------------
* Added Linux desktop detection to the $mobile_first check routine (see previous
changelog details)
version 1.3.5 (2011/11/10) ------------------------------------------------------------
* To work around browser issues with unreliable cookie setting speed
Adaptive Images now also checks the user agent string.
If a desktop environment is detected, $mobile_first is automatically
over-ridden to "FALSE". If not Adaptive Images will obey the configured
This is a safety fallback and requires testing before I revert the
default $mobile_first configured value to TRUE.
version 1.3.4 (2011/11/10) ------------------------------------------------------------
* URLs are now allowed to have spaces and other encoded characters in them
* The sharpening function broke on libraries not compiled with the bundled version
of PHP/GD. Adaptive Images now tests the imageconvolution function is available
and gracefully handles cases where it isn't.
* Instructions to take advantage of high-density displays like Apple's iPhone4
are now included. Just use the alternative JavaScript snippet.
* Set $mobile_first to default to FALSE. Browsers are inconsistent with their
ability to set cookies before requesting <img>s. For more information visit
version 1.3.3 (2011/10/18) ------------------------------------------------------------
* Added Gecko to the auto-disabled $mobile_first check: IE and Firefox don't
honour $mobile_first.
This is because both suffer from a race condition when setting the cookie.
Sometimes it's set before <img> are requested, sometimes not. This could produce
desktop websites with mobile versions on first page load.
* Changed the HTTP Cache Header from "public" to "private".
This allows caches that are specific to one user (e.g., browser cache) to store
the image in cache; shared caches (e.g., a proxy server) won't. This should avoid
people behind proxies or other caching mechanisms experiencing wrongly sized images.
version 1.3.2 (2011/09/06) ------------------------------------------------------------
Thanks to Oncle Tom
* Internet Explorer was not correctly setting the cookie, and thus breaking badly
* Fixed a possible Cookie Injection, and optimised ai-cookie.php
In testing it seems that Firefox is now behaving properly and setting the cookie
in time. Thus, I've re-instated support for $mobile_first = TRUE on that browser
version 1.3.1 (2011/09/06) ------------------------------------------------------------
Thanks to Emilio Bravo
* PNGs now maintain their alpha transparency when scaled down (previously got
black backgrounds where transparency should be)
version 1.3 (2011/09/04) --------------------------------------------------------------
Huge thanks to Jordi Boggiano
* Finalised $mobile_first behaviour and defaulted it to TRUE
* Fixed typo which incorrectly set browser cache
* When $mobile_first is FALSE now sends highest configured size instead of original
* Refactored the PHP to be more robust and efficient
* Simplified the JS to a single line and fixed pollution of the global namespace
* Made the .htaccess rule more robust and accurate
Firefox will not honour $mobile_first as set in the CONFIG section. This is
intentional, and required due to a defect in Firefox's behaviour. It does not set
cookies fast enough, and therefor on the first visit to a site would load the
mobile sized image even if JS was enabled. Therefor, AI will not honour the
$mobile_first setting on Firefox based browsers that have JavaScript disabled.
version 1.3 beta (2011/08/31) ---------------------------------------------------------
* Added support for Mobile First philosophy (see CONFIG, $mobile_first)
When $mobile_first is set to TRUE it means the mobile sized version of the requested
image will be sent in the event that no cookie is set (likely because JavaScript is
unavailable). If FALSE, the original image is sent.
There is a known problem with Firefox on a first visit to a site where $mobile_first
is TRUE. It doesn't set the cookie fast enough, so the very first load sends the mobile
size image. All page loads after are fine. Opera, Safari, and Chrome all work OK.
version 1.2.2 (2011/08/30) ------------------------------------------------------------
* Unsupported no-javascript solution (see instructions.htm)
version 1.2.1 (2011/08/26) ------------------------------------------------------------
I have re-branded Responsive-Images to "Adaptive-Images", firstly to help distinguish
this project from the identically named project by Filament Group, and secondly
because it's a more appropriate name. This system actively adapts existing images as
well as "responding" to the visitors viewport to serve an appropriately sized version.
The project is now available on GitHub for those who wish to track it there:
version 1.2 (2011/08/21) ------------------------------------------------------------
Contributions by Fabian Beiner, with thanks :)
* Support for PNG and GIF images
* Added ability to sharpen re-scaled images (see CONFIG, $sharpen)
* Better extension detection (.jpeg was failing)
* First-run Firefox bug fixed. The JS must be in-line, in the <head>!
Firefox (and potentially others, but not observed anywhere else) was requesting
the first <img> before it loaded the external javascript file, even when in the
<head>. This caused Firefox to load the full-resolution image the very first
time the site was visited. All subsequent page views were fine.
* Cleaned up the .htaccess file and included clear comments on use
* Vastly improved instructions and examples on the downloadable zip
* Since 1.1 fixed issues with browser cache, default cache time now set to 7 days
* Refactored PHP code
version 1.1 (2011/08/16) ------------------------------------------------------------
* Re-engineered the size detection methodology.
Now detects maximum possible screen size of the device instead of the current
window size. This removes the problem of visitors with small windows caching
small images to the browser, then upon maximising the browser having too small
images for the new screen size. It also simplifies the JS back down to its
original "just dump the size into a cookie" functionality.
This update removes the following:
* All JS config options
version 1.0 (2011/08/09) ------------------------------------------------------------
* Headers sent along with the image, for browser side caching (see CONFIG, $browser_cache)
* JavaScript responds to window re-sizes, requests higher res images if required
* Fixed the MIME type for JPG's (image/jpeg not image/jpg)
beta 2 (2011/08/04) -----------------------------------------------------------------
* Added the ability to control generated image quality (see CONFIG, $jpg_quality)
* Added configurable resolution breakpoints (see CONFIG, $resolutions)
* Optional Cache checking - defaults to on (see CONFIG, $watch_cache)
* The PHP now checks that the GD extension is loaded before proceeding
* Clarified comments further
beta 1 (2011/08/01) -----------------------------------------------------------------
* Initial public release
* Commented the PHP for public consumption
* Added user-configurable cache directory (see CONFIG, $cache_path)
* Didn't generate downscaled images due to typo