Starting a iPhone Theme

2

Comments

  • Excellent! Thank you.
  • And build 4475 will isolate options by themes as well as by albums. So you could acutally just set the options the way you want for your iPhone theme. The only drawback is that you will have to set your gallery theme to the iPhone theme while you are setting up the options. Then set it back to whatever you want.
  • This is really a great piece of work - thanks a lot. Have you thought of using jQuery/jQTouch to make it even look more iPhone-ized? I have started looking at it and made a small theme, but I am not familiar with Ajax, so there is little point for me to personally go down this route on my own...
  • The theme installed successfully, but no images thumbnails appear in the album view. If I manually type in a specific image's url, the image.php works properly, but album.php doesn't seem to be generating any thumbnails or links... anyone know what might be causing this?
  • Loaded this theme and changed /zp-core/function.php as noted in the install instructions to make the them work only on iphone browsers. The theme loads just fine and the browser id works great. Only problem is that when I his gallery view I see the same 6 or 7 albums, it never shows me the others. Fix for this?

    Also, could it have a search box? My pics are mostly tagged and it would be very helpful.

    Great theme, thanks for the effort and time you have put into it.
  • Well, changing the core functions can lead to all sorts of problems. That is why we do not recommend it.
  • Thanks guys for the excellent forum. Very helpful for guys like me who are new to php and zenphoto. The iPhone theme works great after a little tweaking due to some older functions being used. I have enabled the support for mobile or non mobile theme based on the browser by updating the functions.php (it's a patchwork, not a good solution) but it seems to be working fine. Now I would like to use some video streaming support (like xmoovStream) to stream flv or mp4 video, and switching the video source based on browser (flv with Flash for Windows/Linux, mp4 with QuickTime for Mac/iPhone/mobile browser). Has anybody done any work on this?
  • acrylian Administrator, Developer
    Not that I know but that is surely possible with a plugin.

    Also, if you have updated the theme and maybe wish to maintain it for the future let us know. Please see the theme section on our "contributor guidelines" on the user guide for info how to provide third party themes so that we can include them on the themes section.
  • I would be happy to provide the minor updates I made to the iPhone theme. Please note that this is not an original theme, I have made two types of modifications:
    1. Updated deprecated functions.
    2. Added a movie icon to overlay movie file images.

    The original theme is available at http://code.google.com/p/zenphotoiphone/. I am not sure whether to contact the creator of the theme to include my updates or to add as new theme. It seems the original theme has not been updated since 9/11/2009.
  • acrylian Administrator, Developer
    I know that it's not an original theme from you..;-) I don't remember under what licence this was released but I would guess modifications would be fine.

    However, a good idea would be to contact its original author first, since it is not that old and may simply fit his needs so he did not see any need to update it.
  • soumenb Member
    I have posted the updated theme in my website. Here's the link to the post: http://ubercyber.net/2010/04/zenphoto-and-iphone-theme/
    Since this theme is specifically for iPhone, some hacks are required so that a proper theme is displayed depending on where the gallery is opened from. The details are in the post, but please note that for full functionality some modifications are required to ZenPhoto core functionality.
    Acrylian has posted a link to my site in the iPhone theme page. A big "thank you" for acrylian. :)
  • There should not need to be any hacks once you move to the 1.3 development base. There are filters that will allow you to "alter" the theme loading.
  • There should not need to be any hacks once you move to the 1.3 development base. There are filters that will allow you to "alter" the theme loading.
  • soumenb Member
    I installed the latest nightly build from 4-30 trunk, and in setup.php got an warning:
    "Perhaps there was a problem with the upload. You should check the following files:"
    And it seemed it listed ALL files under themes (which, of course, I did not update during the installation). I ignored it and went ahead, and now my gallery homepage shows:
    "Fatal error: Only variables can be passed by reference in ...themes/stopdesign/index.php on line 82"
    Should I revert back to the last stable build?
  • acrylian Administrator, Developer
    I would actually suggest to try a reinstall. Sometimes ftp clients mess up files while uploading.
  • Definately reload. That line does not seem correct for the current nightly build. There are no function calls on it.
  • soumenb Member
    It worked on a full reload. Thanks guys!
    A question for sbillard: could you elaborate a bit more/point me to the documentation regarding the "filters that will allow ... to "alter" the theme loading." you had mentioned?
    Not sure if I should continue this discussion on this thread. If required, I will start a new thread for further discussions.
  • The filters are fully defined in the article http://www.zenphoto.org/2010/04/zenphoto-plugin-architecture/.

    The most likely filter for you to use would be "load_theme_script" which would let you change the file that gets loaded.
  • Hi all! Soumen, thanks for keeping the iphone project going! I did reply to your inquiry a while back. Please let me know if you have any other additions for the theme.
    (http://groups.google.com/group/zenphoto-iphone/browse_thread/thread/213a7438f45ebb20/c451916fe06f6316?lnk=gst&q=Bhattacharya#c451916fe06f6316)

    I have previously completed some other major changes to the theme. I just uploading it to the google code site.I included your updates and a login update from PigsLipstick a while back which allows for login. This brings the iphone theme to version 1.3.1!

    Acrylian, would you please include the original link to the google-code site in the listing?

    http://code.google.com/p/zenphotoiphone/
  • acrylian Administrator, Developer
    I will update the entry. Best probably you two try to join forces I guess.
  • Hi Omatzyo,

    A few days ago i installed the zenphotoiphone theme. Just wanted to give you a very positive feedback. It works like a charm. However you may want to update the install instructions to make it work for more mobile devices than just the iphone. I used the script provided by http://detectmobilebrowsers.mobi/ (free for personal use) and i can browse the site with an android device. Thanks again.
  • acrylian Administrator, Developer
    That detection script is sadly not licence compatible with Zenphoto themes which as derivative works from Zenphoto (code wise) are GPL v2 as well.
  • I understand this script can't be shipped with neither zenphoto nor zenphotoiphone. However i was only suggesting to omatzyo to update the install instructions to include a reference to this script -- or any other script by the way (i didn't search very long as this one popped up immediately). While there is a large base of iphone users, there is also a lot of other mobile os users. Just my 2 cents..
  • acrylian Administrator, Developer
    Sure, I understand what you mean. Just wanted to mention it since even for example a photographer's portfolio website might be basically considered a "commercial" use.
  • Indeed. Actually i just realized that modifying zp functions.php core file might not needed. Shouldn't we use a setupTheme filter instead?

    That filter could be provided with zenphotoiphone. If the script detection is found then we use it, otherwise we use the simple iphone detection switch. I guess this would simplify the theme installation.

    That way it would be up to the user to download the detection script and abide to the license agreement. I'm gonna try that tonight and will come back to you (whether i succeed or not).
  • acrylian Administrator, Developer
    There is a filter `load_theme_script` already that probably could be used for this. Zenphoto 1.3.2 (scheduled for January now) will also include a `theme_head` filter to load other css for example. See the user guide plugin documentation for the complete filter list
  • I didn't find the load_theme_filter, but i came up with a somehow functional POC that involves at least two filters (a controller and a list of voters). The latter decide if the client is a mobile device.

    I registered a listener on 'setupTheme'. In the "setupTheme" event handler (the "controller"), the 'mobile_detector' event is fired. It is handled by the "voters". If there is at least one filter that votes for a mobile device, the mobile theme is applied.

    The said mobile theme is defined by the user through an option exposed by the "controller".

    I paste the controller and a voter example below. Please feel free to move the code elsewhere if you find it more appropriate.

    The "controller" :

    `
    <?php
    $plugin_is_filter = 5;
    $plugin_description = gettext("Theme filter");
    $plugin_author = "Gilles Dodinet (gdodinet)";
    $plugin_version = '1.3.1';
    $option_interface = new MobileThemeFilter();

    zp_register_filter('setupTheme', '_getTheme');

    class MobileThemeFilter {
    public static $theme = 'mobile_theme_folder';
    public static $detector_filter = 'mobile_detector';

    function getOptionsSupported() {
    return array(
    gettext('Mobile theme') =>
    array(
    'key' => MobileThemeFilter::$theme,
    'type' => OPTION_TYPE_CUSTOM,
    'desc' => gettext('The theme to use when a mobile device is detected'))
    );
    }

    function handleOption($option, $currentValue) {
    if ( $option == MobileThemeFilter::$theme ) {
    if ( !is_object($_zp_gallery) ) $_zp_gallery = new Gallery();
    $themes = $_zp_gallery->getThemes();

    $themelist = array();
    foreach($themes as $theme => $themeinfo) {
    $themedir = SERVERPATH . '/themes/'.internalToFilesystem($theme);
    $themelist[$theme] = $theme;
    }

    echo '\n";
    echo "";
    generateListFromArray(array($currentValue), $themelist, false, false);
    echo "\n";
    }
    }
    }

    function _getTheme($theme) {
    $is_mobile_device = false;
    $votes = array();
    $votes = zp_apply_filter(MobileThemeFilter::$detector_filter, $votes);
    $option = getOption(MobileThemeFilter::$theme);

    if ( is_array($votes) ) {
    for ( $u = 0; $u < count($votes); $u++ ) {
    $v = $votes[$u];
    if ( $v ) {
    $is_mobile_device = true;
    break;
    }
    }
    } //else a filter forgot to return $votes after voting

    if ($is_mobile_device === true && !empty($option)) {
    $theme = $option;

    }

    return $theme;
    }

    ?>
    `
    "Voter" example using the script mobiledetect script :

    `
    <?php
    $plugin_is_filter = 5;
    $plugin_description = gettext("Mobile detector filter");
    $plugin_author = "Gilles Dodinet (gdodinet)";
    $plugin_version = '1.3.1';

    zp_register_filter('mobile_detector', 'get_mobi_detector');

    //can also provide options isIpad mobile, isBlackberry mobile, etc...
    //better do it in a dedicated 'option provider' plugin so that all
    //detectors can benefit from the user prefs

    function get_mobi_detector($votes) {
    $filename = dirname(__FILE__)."/mobile_detector/mobile_device_detect.php";
    if ( !function_exists('mobile_device_detect') && file_exists($filename) ) { //careful..
    require_once($filename);
    }

    if ( function_exists('mobile_device_detect') ) {
    $votes[] = mobile_device_detect(
    true, //iphone
    false, //ipad
    true, //android
    true, //opera mini
    true, //blackberry
    true, //palm
    true, //windows
    false, //mobile redirect url. Leaving this blank will make the script return true when it detects a mobile
    false //desktop redirect url. Leaving this blank will make the script return false when it fails to detects a mobile
    );
    }
    return $votes;
    }

    ?>
    `
  • acrylian Administrator, Developer
    Best would be to make this a plugin and provide it as download (don't forget to label it PHP 5+ only).
  • It is done. The plugin can be downloaded here: http://gilles.dodinet.fr/news/mobile-theme-filter

    I've also changed the code slightly and fixed a few bugs. The article linked above also includes some minimal doc.

    Regards
  • a quick question on this:

    your install instructions say to unzip it to the zp-extensions folder, did you mean the root/plugins folder? if not, putting it in zp-extensions will likely cause it to be deleted if a user upgrades their gallery as zp has migrated away from this creating a user plugin folder located off root directory
Sign In or Register to comment.