Skip to content

Instantly share code, notes, and snippets.

@tyssen
Created July 19, 2011 13:13
Show Gist options
  • Save tyssen/1092264 to your computer and use it in GitHub Desktop.
Save tyssen/1092264 to your computer and use it in GitHub Desktop.
Modified Config Bootstrap to include img_width global variable
<?php
$default_global_vars['global:img_width'] = '';
$_mobileClients = array("android", "acer", "asus", "alcatel", "sie", "blackberry", "htc", "hp", "lg", "motorola", "nokia", "palm", "samsung", "sonyericsson", "zte", "mobile", "iphone", "ipod", "mini", "playstation", "docomo", "benq", "vodafone", "sharp", "kindle", "nexus", "windows phone","midp", "240x320", "netfront", "nokia", "panasonic", "portalmmm", "symbian", "mda", "mot-", "opera mini", "philips", "pocket pc", "sagem", "sda", "sgh-", "xda");
$mobile = false;
$userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
foreach ($_mobileClients as $mobileClient) {
if (strstr($userAgent, $mobileClient)) {
$mobile = true;
}
}
if($mobile) $default_global_vars['global:img_width'] = '320';
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment