mediawiki/gallery-hack
From unsociable
Requirements
- Install MediaWiki's RSSReader
- Install zenphoto
- Have a text editor handy
rss.php
First thing first, we need to get rss.php in zenphoto giving us what we want in mediawiki. Remember these hacks are for my specific mediawiki install alone so you may want to try different stuff for yourself.
I didn't want to modify rss.php by default because I felt I would probably need a thumbnail'd rss reader from zenphoto (and I was right!). I copied rss.php to rssthumb.php and voila! Instant stuff!
The biggest part I didn't realise though was going to be RSSReader (in mediawiki's) inability to decode zenphotos RSS feed, so you have to get rid of some stuff in rssthumb.php to actually make it really work.
<link>
I changed the default:
<link><?php echo '<![CDATA["HTTP_HOST".WEBPATH.$albumpath.$a['folder'].$imagepath.$r['filename'].$modrewritesuffix. ']]>';?></link>
to
<link><?php echo 'http://'.$_SERVER["HTTP_HOST"].WEBPATH.$albumpath.$a['folder'].$imagepath.$r['filename'].$modrewritesuffix;?></link>
Notice I had to remove <![CDATA[ ]]> chunks.
<description>
Then modified:
<description><?php echo '<![CDATA[<a title="'.$r['title'].' in '.$a['title'].'" href="http://'.$_SERVER["HTTP_HOST"].WEBPATH.$albumpath.$a['folder'].$imagepath.$r['filename'].$modrewritesuffix.'"><img border="0" src="http://'.$_SERVER["HTTP_HOST"].WEBPATH.'/'.ZENFOLDER.'/i.php?a='.$a['folder'].'&i='.$r['filename'].'&w='.$iw.'&h='.$ih.'&cw='.$cw.'&ch='.$ch.'" alt="'. $r['title'] .'"></a>' . $r['desc'] . ']]>';?> <?php if($exif['datetime']) { echo '<![CDATA[Date: ' . $exif['datetime'] . ']]>'; } ?></description>
to
<description><?php echo '<a title="'.$r['title'].' in '.$a['title'].'"href="http://'.$_SERVER["HTTP_HOST"].WEBPATH.$albumpath.$a['folder'].$imagepath.$r['filename'].$modrewritesuffix.'"><img border="0" src="http://'.$_SERVER["HTTP_HOST"].WEBPATH.'/'.ZENFOLDER.'/i.php?a='.$a['folder'].'&i='.$r['filename'].'&w='.$iw.'&h='.$ih.'&cw='.$cw.'&ch='.$ch.'" alt="'. $r['title'] .'"></a>' . $r['desc'];?> <?php if($exif['datetime']) { echo 'Date: ' . $exif['datetime']; } ?></description>
Again removed <![CDATA[ ]]> chunks.
RSSReader.php
add a new argument
I created an arg for itemdesc, this way you can turn on the individual item descriptions to use (be careful, these only work in certain cases)
$itemdesc = true;
if ($argv["itemdesc"]) { //check if argument has been provided
if ($argv["itemdesc"]=="off") $itemdesc = false;
}
modified rss output
I'll have to post this later, the {'s and }'s cause it to jumble up in here.
wiki syntax
Now with the new syntax you should be able to do something along the lines of <rss desc=off itemdesc=on number=10>feedurl</rss>.