Mike’s Linux Desktop Experiences

January 8, 2009

Experimentation with Zenphoto

Filed under: Uncategorized — Mr. Mike @ 5:42 am

I’ve been doing some experimentation with Zenphoto. Trying to create a good php feed for Facebook so that I can be a bit more lazy about posting travel updates. Right now I can transcode a bunch of videos and images on my machine, upload them to Zenphoto, visit the gallery and it will generate the rss feeds and thumbs and everything on the fly.

The problem, or a problem, because there have been many, is that Facebook seems to mess up the RSS feeds. I sent them a message to find out if they could do anything about it. A URL like:

http://www.kallies.ca/photos/zp-core/i.php?a=080705-12%20Sudbury%20to%20Port%20Perry&i=DSCN1110.JPG

Gets converted to

http://www.kallies.ca/photos/zp-core/i.php?a=080705-12%20Sudbury%20to%20Port%20Perry&%3Bi=DSCN1110.JPG

So I did some searching about mod_rewrite and stuff, but instead found a nice idea to just replace some of the variables right off the bat. This is much more precise and should not introduce gaping security holes… unless they’re already there. At the top of i.php in zencore I added:

<?php
// Hack around a facebook bug where & gets changed to &amp%3B
if(isset($_GET['amp;i']))
{
  $_GET['i']=$_GET['amp;i'];
}
if(isset($_GET['amp;s']))
{
  $_GET['s']=$_GET['amp;s'];
}
if(isset($_GET['amp;ch']))
{
  $_GET['ch']=$_GET['amp;ch'];
}
if(isset($_GET['amp;t']))
{
  $_GET['t']=$_GET['amp;t'];
}
if(isset($_GET['amp;cw']))
{
  $_GET['cw']=$_GET['amp;cw'];
}
?>

It seems to work. I’m posting it here, because well, I need to have this somehwere so that when I eventually upgrade, I remember what I did.

What I’m not sure about is why the %3B is converted to a semicolon in the variable names.  I know %3B is a semicolon, but why is it *converted*?  I’m surprised that a semicolon is a valid array index in PHP.

Advertisements

2 Comments »

  1. Hey did you get this running the way you wanted?
    I’ve been futzing with the existing facebook pluggins for zenphoto with no luck at all.
    My PHP is pretty limited so I doubt I could help you… but if you manage to find a solution here I’d LOVE to hear about it.

    Comment by Ben — March 18, 2010 @ 12:04 pm | Reply

  2. The solution *did* work. I’m not thrilled with how Facebook takes up the feed. It looks *okay* I guess.

    The basic idea of the solution above is that what *should* be

    i=DSCN1110.JPG

    instead gets mangled by Facebook into:

    amp;i=DSCN1110.JPG

    So the php code checks if Facebook set the “i” variable. If it didn’t, then it sets it to what amp;i was.

    It was a while back that I hacked with this, and Facebook did some major changes, so I’m not sure if the problem still exists.

    (Note that WordPress might be messing up some of my special characters too)

    Comment by Mr. Mike — March 19, 2010 @ 12:12 pm | Reply


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: