Help: some thumbnails do not show
rujero
Registered Users Posts: 15 Big grins
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;
$thumbid = $album;
$thumbkey = $album;
if (!empty($thumbid)) {
$photo = $f->images_getInfo("ImageID={$thumbid}", "ImageKey={$thumbkey}");
$url = $photo;
$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;
$thumbid = $album;
$thumbkey = $album;
if (!empty($thumbid)) {
$photo = $f->images_getInfo("ImageID={$thumbid}", "ImageKey={$thumbkey}");
$url = $photo;
$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
0
Comments
It works the same with all browsers and with any URL size (tried Thumb and Tiny and Small).
The URLs are all fine (used individually, the photos appear) but when they are together in the table some (always the same) don't show...
Anybody there?
Do you have some samples urls that don't work ?
Cheers,
David
SmugMug API Developer
My Photos
Yes it is consistent and no, it's not related to security. If you load (on another browser tab) the individual photo that does not load in the gallery list it loads fine.
ok, got a url ?
SmugMug API Developer
My Photos
Sure:
http://www.rujerotest.com.php5-5.dfw1-2.websitetestlink.com/smugLoadGalleries.php
It will work fine when loading the image directly in the browser, but if you try to load it from another domain, it won't.
So your options are to either...
- filter any gallery that has 'External' set to false via the api
- or set External Links to YES in each gallery.
Cheers,
David
SmugMug API Developer
My Photos