flickrish + php 5.1 + ZP 1.2.8

Hi, I'm trying to use flickrish, but it is using some calls that are for php 5.2 only.

I'm going to try to update it to be php 5.1 tolerant, as well as try to add some options and make it more ZP 1.2.8 tolerant. However, PHP is not my native language, so I need a little assistance from the developers.

The function that is 5.2 only is date_format().
Question 1. Is there an equivalent in 5.1
Question 2. What variable hold the PHP version, or is there a way to ask php if a function exists?

Ideally I'ld like to setup a small function in the theme that checks if date_format is available, otherwise just gives you back an unformatted date.

Once I get passed that, I hope to add support for :
- google maps
- shutterfly

TIA,
-m

Comments

  • acrylian Administrator, Developer
    Sorry, you should really contact the author of flickrish as this is not a supported theme. Zenphoto itself is not strictly PHP5.2 although recommended to use.

    Also this is not the right place for general PHP learning questions. Try searching on http://php.net or one of the many PHP support forums.
  • :P

    Author is MIA and hasn't touched this in a year. I'm trying to develop for ZenPhoto, to make a theme more usable for all users, throw me a bone here. Themes like this will make ZP more popular IMHO.

    I found what I was looking for : function_exists(). I made a wrapper function to check for date_create/date_format() so now the theme is 5.1 and 5.2 compatible. I also made a check for GetImageMetaData() vs GetImageEXIFData() to make the theme work w/ various versions of ZP out of the box.

    Next problem : "Undefined variable: _zp_themeroot" ...
    I'm guessing this some global that was deprecated between ZP versions?

    -m
  • acrylian Administrator, Developer
    Don't get me wrong we appreciate any work for Zenphoto but we just not have the time to support all stuff and surely not general php questions.

    GetImageMetaData() vs GetImageEXIFData()
    The latter is stil located in the deprecated functions plugin.

    `$_zp_themeroot` is a standard global available for all themes and not deprecated. You see it easily in every standard theme. (We have a list of globals on the user guide).

    Btw, if you haven't yet, you should now read the theming tutorial.
  • I just paged through the theming tutorial, thanks -- that clears up the general architecture for me. Luckily I'm just trying to modify a mostly working theme, not start from scratch.

    So there is some sort of scope issue w/ $_zp_themeroot where in one case it is not defined. This is for a page custom to this theme called textimage.php. It is called w/ this line from header.php :

    <img src="<?php echo $_zp_themeroot ?>/textimage.php?txt=<?php echo getGalleryTitle();?>" />

    That instance of $_zp_themeroot is defined, but when textimage.php is loaded by itself, I'm guessing it is outside of the normal zenphoto frame work and so that global isn't defined. textimage.php creates and returns an image/png.

    Is there a certain include I need to add at the top of textimage.php to get the ZP globals perhaps?

    Thanks for your time,
    -m
  • The technique you have used to load the textimage.php page does not route it through the normal zenphoto sequeced, it just starts it directly. So, of course, nothing is setup for you. There are two scripts in zenphoto that operate similarly to what you are doing--i.php and c.php. You should review how they work and how i.php deals with themes.
  • Thanks for the hint.. I've changed this line :
    `$font = $_zp_themeroot .'/fonts/arial.ttf';`

    to
    `$font = dirname(__FILE__).'/fonts/arial.ttf';`

    and now it's not barfing out any more warnings to apache's error_log.

    Next up : google maps.
  • acrylian Administrator, Developer
    I don't know anything about this theme but why does that include the Arial font that is a standard on any Windows and Mac anyway?
  • That's a very good question. I'm sure the GD library or whatever is doing the text to image conversion will have Arial available. There are a few images and .ttf's in there that are of questionable re-distribution -- but that's easy enough to fix.

    I have to say I was blown away about how easy integrating the google map plugin was... one call on two pages each. I had that working in about 10 minutes. I'm now working on parameterizing some of the hard-coded stuff into theme options. I'll see about cleaning up the font files and then post my changes. Any other clean-up suggestions are welcome. Demo here : http://warped.org/photos/Places/thailand/thailand_knm-0003.jpg.php
Sign In or Register to comment.