Options

Help: some thumbnails do not show

rujerorujero 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

Comments

  • Options
    rujerorujero Registered Users Posts: 15 Big grins
    edited November 28, 2009
    Also...
    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...
  • Options
    rujerorujero Registered Users Posts: 15 Big grins
    edited December 1, 2009
    Hello?
    Anybody there?
  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited December 1, 2009
    Do certain thumbs consistently not display ? It could be related to album security settings.

    Do you have some samples urls that don't work ?

    Cheers,

    David
    David Parry
    SmugMug API Developer
    My Photos
  • Options
    rujerorujero Registered Users Posts: 15 Big grins
    edited December 1, 2009
    devbobo wrote:
    Do certain thumbs consistently not display ? It could be related to album security settings.

    Do you have some samples urls that don't work ?

    Cheers,

    David

    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.
  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited December 1, 2009
    rujero wrote:
    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 ?
    David Parry
    SmugMug API Developer
    My Photos
  • Options
    rujerorujero Registered Users Posts: 15 Big grins
    edited December 1, 2009
  • Options
    devbobodevbobo Registered Users, Retired Mod Posts: 4,339 SmugMug Employee
    edited December 2, 2009
    The reason the images aren't showing up is because the gallery that contains each image has the option 'External Links' set to NO.

    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
    David Parry
    SmugMug API Developer
    My Photos
  • Options
    rujerorujero Registered Users Posts: 15 Big grins
    edited December 2, 2009
    You are a star!!! Thank you so much! wings.gif
Sign In or Register to comment.