Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo

Close

#44 Add Piclens Support with firefox

open
nobody
None
5
2008-06-17
2008-06-17
Anonymous
No

Piclens in a nice plugin for firefox. it could be a good idea to add a piclens rss flow to phpgraphy

Discussion

  • Logged In: YES
    user_id=2120672
    Originator: NO

    Here are my first test : it works well
    - 1 new file (photos.rss.php)
    - 1 line to add in each header.inc.php (for each theme)

    ---------------------------------------------
    Add this line in the header.inc.php, in the head head section

    <!-- Piclens -->
    <link rel="alternate" href="photos.rss.php<?if(isset($_REQUEST['dir'])) echo '?dir=', base64_encode($_REQUEST['dir']);?>" type="application/rss+xml" title="" id="gallery" />

    ---------------------------------------------
    photos.rss.php : add this file with the master index.php file

    <?

    // parameters
    $SITE = 'http://127.0.0.1/phpgraphy-0.9.13a';
    $PICTURE_ABS = '/pictures';
    $PICTURE_REL = '../pictures';
    $PICTURE_SITE = 'http://127.0.0.1';

    function parseAlbum($dossier)
    {
    global $SITE, $PICTURE_REL, $PICTURE_ABS, $PICTURE_SITE;

    // echo $dossier . "<br>\n";
    $rep=$PICTURE_REL.'/'.$dossier;
    $dir = opendir($rep);

    while (false !== ($file = readdir($dir)))
    if(strpos(strtolower($file),'.jpg')!==false)
    {

    $udossier = rawurlencode($dossier);
    $ufile = rawurlencode($file);

    echo '<item><title>', urlencode($file),'</title>'."\n";
    echo '<link>', $SITE,'/index.php?displaypic=',$udossier,'%2F',$ufile,'</link>'."\n";
    // echo '<description> ',$file,' </description>'."\n";
    echo '<guid isPermaLink="true">', $SITE,'/index.php?displaypic=',$udossier,'%2F',$file,'</guid>'."\n";
    echo '<media:content url="',$PICTURE_SITE.$PICTURE_ABS,'/',$udossier,'/',$ufile,'" />'."\n";
    echo '<media:thumbnail url="',$PICTURE_SITE.$PICTURE_ABS,'/',$udossier,'/.thumbs/thumb_',$ufile,'" />'."\n";

    echo '</item>'."\n";
    }

    closedir($dir);
    }

    echo '<?xml version="1.0" encoding="utf-8" standalone="yes"?>'."\n";
    echo ' <rss version="2.0" xmlns:media="http://search.yahoo.com/mrss/" xmlns:atom="http://www.w3.org/2005/Atom">'."\n";
    echo ' <channel>'."\n";

    if(!isset($_REQUEST['dir']))
    {
    parseAlbum($_REQUEST['.']);
    }
    else
    {
    $requestdir = base64_decode($_REQUEST['dir']);
    parseAlbum(utf8_encode($requestdir));
    }

    echo '</channel>'."\n".'</rss>';
    ?>

    ---------------------------------------------------------