Skip to content

Instantly share code, notes, and snippets.

@janv
Created February 9, 2012 16:46
Show Gist options
  • Save janv/1781021 to your computer and use it in GitHub Desktop.
Save janv/1781021 to your computer and use it in GitHub Desktop.
Wordpress imgly-gallery fix
<?
function imgly_pics($username = '', $num = 4, $linked = true, $size = 75, $margin = 5, $border = 0, $bordercolor = '#FFFFFF') {
$file = @file_get_contents("http://img.ly/images/".$username.".rss");
preg_match_all('/<link>http:\/\/img.ly\/(\w+)<\/link>/i', $file, $matches);
$imageids = $matches[1];
for($i = 0; $i < $num; ++$i) {
$imageid = $imageids[$i];
if($linked == true) {
echo '<a href="http://img.ly/'.$imageid.'" target="_blank">';
}
echo '<img src="http://img.ly/show/mini/'.$imageid.'" width="'.$size.'" height="'.$size.'" style="margin: '.$margin.'px; border: '.$border.'px solid '.$bordercolor.';" class="imgly" />';
if($linked == true) {
echo '</a>';
}
echo "\n\n";
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment