rujero
Nov-28-2009, 11:28 AM
Hi everyone!
I am trying to display the list of my galleries showing the highlight photo thumbnail and the gallery title in a table built with PHP.
Some galleries do not have a highlight photo so I am showing the text "missing etc." but in for a few other the highlight photo exists but does not show in the browser. :scratch
Here is my code:
<?php
$userName = 'domenichini';
require_once("../phpSmug/phpSmug.php");
try {
// Create new phpSmug object
$f = new phpSmug("APIKey=DgWiSWtTTJ4jk4vm0TWR9gAgbgNLxkft", "AppName=youtellyou (http://youtellyou.com)", "APIVer=1.2.2");
// Login Anonymously
$f->login();
// Get list of public albums
$albums = $f->albums_get('NickName=' . $userName, "Heavy=1");
$mod = 3;
$rString = '<table>';
$i = 0;
foreach ($albums as $album) {
$i++;
if (($i-1) % $mod == 0)
$rString .= '<tr>';
$title = $album['Title'];
$thumbid = $album['Highlight']['id'];
$thumbkey = $album['Highlight']['Key'];
if (!empty($thumbid)) {
$photo = $f->images_getInfo("ImageID={$thumbid}", "ImageKey={$thumbkey}");
$url = $photo['SmallURL'];
$rString .= '<td width="130"><img style="max-height:120px; max-width:120px;" src="' . $url . '"></td>';
}
else {
$url = '';
$rString .= '<td width="130">featured photo missing</td>';
}
$rString .= '<td width="130">' . $title . '</td>';
if ($i % $mod == 0)
$rString .= '</tr>';
} // foreach
} //try
catch (Exception $e) {
echo "{$e->getMessage()} (Error Code: {$e->getCode()})";
}
if ($i % $mod != 0)
$rString .= '</tr>';
$rString .= '</table>';
echo $rString;
?>
As you can see, no rocket science here. If you run this code (you might have to change the location of the phpSmug include) you can see what I mean.
I would very much appreciate any help, cheers,
rujero domenichini
I am trying to display the list of my galleries showing the highlight photo thumbnail and the gallery title in a table built with PHP.
Some galleries do not have a highlight photo so I am showing the text "missing etc." but in for a few other the highlight photo exists but does not show in the browser. :scratch
Here is my code:
<?php
$userName = 'domenichini';
require_once("../phpSmug/phpSmug.php");
try {
// Create new phpSmug object
$f = new phpSmug("APIKey=DgWiSWtTTJ4jk4vm0TWR9gAgbgNLxkft", "AppName=youtellyou (http://youtellyou.com)", "APIVer=1.2.2");
// Login Anonymously
$f->login();
// Get list of public albums
$albums = $f->albums_get('NickName=' . $userName, "Heavy=1");
$mod = 3;
$rString = '<table>';
$i = 0;
foreach ($albums as $album) {
$i++;
if (($i-1) % $mod == 0)
$rString .= '<tr>';
$title = $album['Title'];
$thumbid = $album['Highlight']['id'];
$thumbkey = $album['Highlight']['Key'];
if (!empty($thumbid)) {
$photo = $f->images_getInfo("ImageID={$thumbid}", "ImageKey={$thumbkey}");
$url = $photo['SmallURL'];
$rString .= '<td width="130"><img style="max-height:120px; max-width:120px;" src="' . $url . '"></td>';
}
else {
$url = '';
$rString .= '<td width="130">featured photo missing</td>';
}
$rString .= '<td width="130">' . $title . '</td>';
if ($i % $mod == 0)
$rString .= '</tr>';
} // foreach
} //try
catch (Exception $e) {
echo "{$e->getMessage()} (Error Code: {$e->getCode()})";
}
if ($i % $mod != 0)
$rString .= '</tr>';
$rString .= '</table>';
echo $rString;
?>
As you can see, no rocket science here. If you run this code (you might have to change the location of the phpSmug include) you can see what I mean.
I would very much appreciate any help, cheers,
rujero domenichini