Tell me more ×
SmugMug Stack Exchange is a question and answer site for SmugMug developers and end users. It's 100% free, no registration required.

After arranging images in an album using the SmugMug drag/drop "arrange mode", smugmug.images.get will not return the updated image positions. The images do appear in the correct order within the album on the SmugMug site.

As far as I can tell, the position attribute is set on SmugMug once when the album is created, and not updated in a way that can be accessed by the API. Can anyone help me understand how to get the updated image position?

Other attributes appear to update immediately (keywords, caption, etc).

Here's my API request, using phpSmug:

    // Create a new instance of phpSmug
    $f = new phpSmug( array(
        'APIVer'      => SMUGMUG_SYNC_API_VER,
        'AppName'     => SMUGMUG_SYNC_APP_NAME,
        'APIKey'      => SMUGMUG_SYNC_API_KEY,
        'OAuthSecret' => SMUGMUG_SYNC_OAUTH_SECRET
    ) );

    // Try to connect to SmugMug
    try {

        // Authorize
        $f->setToken( array(
            'id'     => $app_token['Token']['id'],
            'Secret' => $app_token['Token']['Secret']
        ) );

        // get images
        $images = $f->images_get( array(
            'AlbumID'  => $album->album_id,
            'AlbumKey' => $album->album_key,
            'Extras'   => 'id,Key,Caption,Keywords,LastUpdated,URL,LargeURL,SmallURL,ThumbURL,MediumURL,OriginalURL,Position'
        ));

    } catch ( Exception $e ) {
        echo json_encode(array(
            'message' => "{$e->getMessage()} (Error Code: {$e->getCode()})",
            'success' => false
        ));
        die();
    }

And here's an example response for $images:

[0] => Array
    (
        [id] => 2153130465
        [Key] => nhg9fVz
        [Caption] => 
        [Keywords] => 315564, 10151188718698686, 1795018302
        [LargeURL] => http://www.davidmoskowitz.net/photos/i-nhg9fVz/0/L/i-nhg9fVz-L.jpg
        [LastUpdated] => 2012-10-15 21:48:19
        [MediumURL] => http://www.davidmoskowitz.net/photos/i-nhg9fVz/0/M/i-nhg9fVz-M.jpg
        [OriginalURL] => http://www.davidmoskowitz.net/photos/i-nhg9fVz/0/O/i-nhg9fVz.jpg
        [Position] => 2
        [SmallURL] => http://www.davidmoskowitz.net/photos/i-nhg9fVz/0/S/i-nhg9fVz-S.jpg
        [ThumbURL] => http://www.davidmoskowitz.net/photos/i-nhg9fVz/0/Th/i-nhg9fVz-Th.jpg
        [URL] => http://www.davidmoskowitz.net/Other/Test-Gallery/25960738_dSjkrH#2153130465_nhg9fVz
    )

Any help would be much appreciated!

Thanks,

Darin

share|improve this question
How do you arrange images - do you use the API or one of the SmugMug arrange tools - if the latter, which tool? Are you sure that the gallery is set to autosort "none"? I'm not a programmer, but it might be helpful if you could provide a specific example of your full request and the response you get. Also what response are you expecting? – Sebastian Oct 16 '12 at 9:02
(updated question above) I'm using the SmugMug "arrange mode" to order images within the SmugMug site, and I confirmed that gallery is set to autosort: none. The order does update on the SmugMug site, just not in the 'position' returned in the API response. – Darin Reid Oct 16 '12 at 15:47
Unfortunately position isn't to be relied on, look at the order the photos are returned in the array – Shizam Nov 16 '12 at 18:43

1 Answer

Same issue for me. I noticed on a smugmug gallery page the value updates to show proper position in the nav "x of 10". So either there is a way to update this or they are using some other way. I guess I'm going to add a new position value when I run through my foreach I'm currently using to build my gallery markup.

share|improve this answer
I ended up having to rely on the order items are returned from the API call as an indicator of position, which seems to work so far. – Darin Reid Nov 8 '12 at 16:30

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.