I understand your concerns.. maybe not a forced feature, but an option then.
Using SetWidth/height in your template will create different sizes, but it will force to load both small and large size. We dont want this, because we want to save bandwidth. Template should just have the @1x version in the source code. E.g $RetinaImage.SetWith(400) ... the class should then create an @1x which is 400px width and an @2x which is 800px width. The .htaccess should then decide which file to load.
--> Does any one know how to make such an image class/ code?
So in the template you set the size for the @1x image, and the retina image class should create an @2x automatically.
--> How do you rewrite the htaccess?
http://shauninman.com/tmp/retina/
how do you merge this:
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine on
RewriteCond %{HTTP_COOKIE} HTTP_IS_RETINA [NC]
RewriteCond %{REQUEST_FILENAME} !@2x
RewriteRule ^(.*)\.(gif|jpg|png)$ $1@2x.$2
# if @2x isn't available fulfill the original request
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)@2x\.(gif|jpg|png)$ $1.$2
</IfModule>
with this:
### SILVERSTRIPE START ###
<Files *.ss>
Order deny,allow
Deny from all
Allow from 127.0.0.1
</Files>
<Files web.config>
Order deny,allow
Deny from all
</Files>
ErrorDocument 404 /assets/error-404.html
ErrorDocument 500 /assets/error-500.html
<IfModule mod_alias.c>
RedirectMatch 403 /silverstripe-cache(/|$)
</IfModule>
<IfModule mod_rewrite.c>
SetEnv HTTP_MOD_REWRITE On
RewriteEngine On
RewriteBase '/'
RewriteCond %{REQUEST_URI} ^(.*)$
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule .* framework/main.php?url=%1&%{QUERY_STRING} [L]
</IfModule>
### SILVERSTRIPE END ###