Zenphoto Mobile Hacks

I am still using very old zen-photo 1.0.8. Here are some hacks for mobile compatible zen-photo gallery.

1. Create separate mobile folder called "mobile" or "iphone" or "wap" into theme folder. Write your wap/xhtml/iphone specific theme code in "index.php", "album.php" & "image.php"

2. open index.php,

now, we need to detect mobile, & replacing existing theme with mobile one. So, we can get theme with $theme = $_zp_gallery->getCurrentTheme();

Replace that line with $UA = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : "";
$cldc = stristr($UA, 'cldc') ? true : false;
$midp = stristr($UA, 'midp') ? true : false;
$OPWV = stristr($UA, 'OPWV') ? true : false;
$iphone = stristr($UA, 'iPhone') ? true : false;

if($cldc || $midp || $OPWV || $iphone){
$theme = "mobile"; // It's telling zenphoto to open mobile theme.
}else{
$theme = $_zp_gallery->getCurrentTheme(); // It's your regular theme
}

3. open zen/zp_config.php here we need to change thumbnail, resolution, photo, album par page, photos per page etc accoding to mobile compitibility.

e.g.

if($cldc || $midp || $OPWV || $iphone){
$conf['image_quality'] = 55; // lesser values for faster loading on mobile
$conf['thumb_quality'] = 60;
$conf['albums_per_page'] = 5; // less albums to prevent memory overflow in 40 series mobile
$conf['images_per_page'] = 5; // less photos to prevent memory overflow in 40 series mobile
//... change some other parameters for mobile compatibilities
}else{
// your regular one
}

So, finally BollySite (http://actress.bollysite.com) zen-photo goes mobile. You may check it on your mobile GPRS.

Still I am beautifying the theme in incremental way... but zenphoto team may think to include these feature by next release.

Comments

  • acrylian Administrator, Developer
    Definatly a good idea, although I don't know anyone who uses a mobile for browsing (yet) and I don't have any mobile phone (yes, I am one of the few people who still don't have one!) to test that but looks quite good in Opera 9's small screen feature.

    Generally any theme that separates html and css styling should be somehow usable in an mobile environment. So could you please open a feature request ticket and attach that code there, so this does not get lost? Thanks.
  • arun Member
    Hi all, acrylian please post new version of mobile mode here!. :)
  • acrylian Administrator, Developer
    This is not my project and we have no mobile theme available (see the themes page).
  • arun Member
    Hey i'm just posted my request. please help me to redirect mobile users to another mobile theme, i want only redirect code. not a theme r anything else
  • acrylian Administrator, Developer
    But you did address me by name... Anyway, sorry, I can't help with this. Try the above way or try google.
  • arun Member
    ok anyway thank you for your kind reply.
Sign In or Register to comment.