ãWebã¢ããªãiPhone4 ã§ç»åããããã«è¡¨ç¤ºããããä¸ã¤ã®æ¹æ³ãmod_rewriteã
iPhone4ã¯è§£å度ãé«ãã®ã§ãç»åãåãæ¿ããªãã¨ãããã£ã¨ããã
Retinaãã£ã¹ãã¬ã¤ã«ç»åãæé©åãããã®ã£ã¦æå¤ã¨ããã©ãããï¼
ã¨ããç¾å®ã«æã¡ã®ããããã®ã§ãã¾ã¨ãã¦ã¿ã¾ãã
ã«ããã¨
- ããã¶é«è§£å度ã®ç»åã«ãã â 3Gã§è¡¨ç¤ºãéããã
- ç»åã2種é¡ã¤ãã£ã¦åãæ¿ãã â ç»åã®æ°ãå¤ãã¨ã²ã¨ã¤ã²ã¨ã¤CSSæå®ããã®ãè¾ããã
- ç»åã¯ã¹ã±ã¼ã©ãã«ãªãã¼ã¿å½¢å¼ã§ç¨æãã â 次ã«ä½ãã¨ãã¯ãããããâ¦â¦
- ç»åã¯ãããã使ããªããã¶ã¤ã³ã«ãã â 次ã«ä½ãã¨ãã¯ãããããâ¦â¦
ã¨ãããã¨ã§æ±ºå®æã¯ãªããããªæãã
ã§ããç»åã®åãæ¿ãã£ã¦ USER_AGENT è¦ã¦ mod_rewrite ã§ç»åç½®ãæããã°æ¥½åãããï½ï½ï½ï½ ã¨ãæã£ã¦èª¿ã¹ãããiphone3ã4ãåããªã®ãâ¦ãµã¼ãã§iphone3ã4ãè¦åããã®ã¯ç¡çã
ãªãããã£ã¨ããæ¹æ³ç¡ãã®ãã¼ã¨æ¢ãåã£ãã
ãã®ããSDK4ã§ã¯æ¢åã®ç»åã®ãã¡ã¤ã«åã®å¾ã«ã@2xãã¨ããæååãä»ãã¦ã
ãæ¢åãã¡ã¤ã«å@2x.æ¡å¼µåãã¨ããå½¢ã§åããã¹ã«è¨ç½®ãããã¨ã§ã
iPhone4ã®å ´åã¯@2xã®ç»åãåªå ãã¦ä½¿ç¨ãããã¨ãåºæ¥ã¾ãã
ã¨ããã表è¨ãè¦ä»ãã¦å¤§åã³ãããã©ç¡çã§ãããã¢ããªã ããªã®ãã
æ®éã«èãã¦ãããªãªã¯ã¨ã¹ãæ°ãäºåã«ãªããããªä»æ§å
¥ãããããªãâ¦â¦
ã§ã¾ããããã§ããã¡ãã£ã¨èããã
ãã©ã¦ã¶ã®èªã¿è¾¼ã¿ã¯å¸¸ã«HTMLâç»åã§ãããHTMLä¸ã§ã¯javascriptãåãã®ã§ãããã«ãªã¯ã¨ã¹ããããã«å½±é¿ãä¸ããããä½ããæ¸ãã¦ããã°ãããcookieã ã
ä»åã¯å
¨é¨ã®ç»åã«ã¤ãã¦é«è§£å度çãç¨æããå¿
è¦ããªãã¨å¤æããã®ã§ï¼DBã«å
¥ã£ã¦ããã®ããããï¼ããã¡ã¤ã«åã®æå¾ã« @1x ã¨ã¤ãã¦ãããã¡ã¤ã«ã®ã¿ãããã @2x ã«ç½®ãæããããã«ããã
<html> <head> <script> document.cookie = "pxratio="+window.devicePixelRatio+"; path=/;"; </script> </head> <body> <img src="[email protected]" height="43" width="100" alt="é«è§£å度ãç¨æ"> <img src="button2.png" height="43" width="100" alt="é«è§£å度ã¯ç¨æããªã"> </body> </html>
ã¾ã¼æ®éã®ãã¬ã¼ã ã¯ã¼ã¯ã¨ã使ã£ã¦ãã°å ¨é¨ã®ãã¼ã¸ã®ãããã«jsæ¸ãè¾¼ãã¨ãç°¡åãªã¯ããããã§è§£å度äºåã®ç°å¢ã§ã¯ãç»åãªã¯ã¨ã¹ãæã®ã¯ããã¼ã«ã pxratio=2 ããæ¸ãè¾¼ã¾ãããå¾ã¯ mod_rewrite ã§æ¯ãåãã¦ããã°ããããã¡ã¤ã«åãæå®ãããã®ãä¸æ¬ç½®æã§ããç°å¢ãç¨æããã®ã¯é£ãããªãã
å¾ã¯ httpd.conf ã§
RewriteEngine on RewriteCond %{HTTP_COOKIE} pxratio=2 RewriteRule ^(.*)@1x(\.[^.]*)$ $1@2x$2
ã®ãããªæå®ãé©å½ãªã¨ããã«æ¸ãã
ããã§ä»åã®ç®çã¯éæãããã