Skip to content

Instantly share code, notes, and snippets.

@lildude
Last active December 20, 2015 04:18
Show Gist options
  • Save lildude/6069369 to your computer and use it in GitHub Desktop.
Save lildude/6069369 to your computer and use it in GitHub Desktop.
PHP code and phpZenfolio calls used in the Coin Slider example at http://phpzenfolio.com
<div id="slider" style="background-color:#fff;margin:0 auto;">
<?php
if ( !class_exists( 'phpZenfolio' ) ) {
require_once( 'phpZenfolio/phpZenfolio.php' );
}
$out = '';
$f = new phpZenfolio( 'AppName=phpZenfolio Demo (http://phpzenfolio.com)' );
$f->enableCache( 'type=fs', 'cache_dir='.HABARI_PATH . '/user/cache/', 'cache_expire=86400' );
// Taken from the source of http://demo.zenfolio.com/
$set = $f->LoadPhotoSet( 844670625, 'Level1', TRUE );
foreach ( $set['Photos'] as $p ) {
try {
$c = $f->LoadPublicProfile( $p['Owner'] );
$out .= '<a href="'.$p['PageUrl'].'" title="Visit Photo Page" target="_blank">';
$out .= '<img src="'.phpZenfolio::imageUrl($p, 3).'" title="Copyright © '.$c['DisplayName'].'" />';
$out .= '<span><span class="alignleft">'.$p['Title'].'</span>Copyright © '.$c['DisplayName'].'</span>';
$out .= '</a>';
}
catch ( Exception $e ) {
// This happens if the photo still exists, but the account has gone missing.
continue;
}
}
echo $out;
?>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment