Quantcast
Channel: Digital Grin Photography Forum - SmugMug APIs, Hacks & Tricks
Viewing all 147 articles
Browse latest View live

Uploaded videos are shrunk drastically

$
0
0
In testing my uploading utility, I noticed that a video file is changed after uploading.

My local copy has:
MD5 hash: dcf4df33ba7375fdb57f7adcdc58a7d2
file size: 901,384,32 (90 MB)
After uploading, in the album, the file has:
MD5 hash: b1aad449121f76ea7eebe455ff395d87
file size: 153,460 (153k)
Further, the caption is lost after uploading (although the keywords remain).

There are no errors; the upload is successful. The video file in the album is the correct duration.

Photo Links as /photo/

$
0
0
I am using API 1.3.0 in a PHP program to embed photo urls in a blog. The API images.getURLs function, returns the photo URLs such as: http://example.smugmug.com/Motorhome...64762_1-Th.jpg.

I dislike the URL containing the folder structure in case I move the photos.

The API docs for images.getURLs show the URL examples with just the folder structure as /photos/. Example: http://example.smugmug.com/photos/i-...64762_1-Th.jpg.

I discovered this works! I can replace the folder structure with a simple /photos/ for a much simpler URL.

Is there a way to force the API to return a URL with /photos/?


Thanks

[API] smugmug.images.get with Password not working

$
0
0
Hi, i'm writing an android app that make use of smugmug for showing my images,
I have several albums both public and private

i'm using the json version of the API

i can easily get the list of albums

eg: http://api.smugmug.com/services/api/...lbumKey=253ZNn

and as easy as the first call i can get the list of images for a public album

eg: http://api.smugmug.com/services/api/...lbumKey=fRm7bV

but when i want to get the list of photos for a protected album i'm not being able to make it work

could somebody tell me how i have to pass the password?

setting either the pass to the Password or SitePassword parameter is not working

eg: http://api.smugmug.com/services/api/...assword=qweasd

how would you do??

thanks

What is the most efficient API method for uploading a 32GB video to SmugMug?

$
0
0
I've developed a front end that enables authenticated users to upload images and videos by dragging-and-dropping them onto an ASP.NET web page. Based on a couple menu selections on that page, the appropriate SmugMug gallery is created and/or targeted. The uploaded files are saved to temp files on our server before they are uploaded from our servers to SmugMug. We decided to upload the files to our servers first for the following reasons:
  • When I first started the project, I understood neither the open source front-end nor the SmugMug API. This architecture allowed me to postponed my deep-dive into the SmugMug API and still make progress.
  • SmugMug sometime takes a couple minutes to produce a thumbnail image after a file is uploaded. Our architecture enables us to derive a temporary thunbnail on our server to provide more immediate feedback to the user.
  • I'm still not sure how to call the SmugMug API from javascript. But, I'm not sure we could do so without exposing our SmugMug security credentials to a sophisticated end user.

As of this writing, I am using API 1.2.2 to upload files from our servers to SmugMug as follows:

Code:

        public Image UploadImage(string sessionId, string path, IdType albumId, string albumKey, string caption, string keywords, IUploadProgress callback)
        {
            Require.NotNullOrEmpty(sessionId, "sessionId");

            FileInfo info = new FileInfo(path);
            if (!info.Exists)
            {
                throw new ArgumentException("Image does not exist: " + info.FullName);
            }
            using (FileStream stream = File.OpenRead(info.FullName))
            {
                UploadContext context = GetUploadContext(sessionId, stream, path, albumId, albumKey, caption, keywords);
                //Logger.Info("Uploading {0} ({1} bytes)", path, stream.Length);
                // context.ChunkSize = Math.Max((int)(context.PhotoStream.Length / 100), 65536)
                while (UploadChunk(context))
                {
                    //Logger.Info("{0}% complete", context.PercentComplete);
                    if (callback != null)
                    {
                        callback.SetProgress(context.PercentComplete);

                        if (callback.Canceled)
                        {
                            //Logger.Warn("Upload Cancelled");
                            return null;
                        }
                    }
                }
                //Logger.Info("Upload Complete");
                context.RequestStream.Close();
                context.RequestStream.Dispose();

                WebResponse httpResponse = context.Request.GetResponse();
                using (StreamReader reader = new StreamReader(httpResponse.GetResponseStream()))
                {
                    string result = reader.ReadToEnd();
                    reader.Close();
                    reader.Dispose();
                    httpResponse.Close();

                    //Logger.Info(result);

                    var response = protocol.GetResponse<Image>(result);
                    if (response.Error != null)
                    {
                        SmugmugException exception = new SmugmugException((FaultCode)response.Error.ErrorCode);
                        if (callback != null)
                            callback.Error(exception);
                        else
                            throw exception;
                    }
                    if (callback != null)
                        callback.Completed(response.Data);
                    return response.Data;
                }
            }
        }

The only major drawback to this approach is that the project bar displayed to users during the upload is close to 100% when the upload to SmugMug is just getting started.

Here are my questions:
  1. What is the optimal chunk size for SmugMug?
  2. How can the efficiency of the method above be improved?
  3. What other method would be more efficient than the above?
  4. Can you point me to an example where chunked SmugMug upload is invoked from Javascript that would not expose our SmugMug security credentials?
I have to finish this by 31 May 2014 at the latest. So, I don't have time to wait for API 2.0. I assume that means I must use API 1.2.2 or 1.3.

Any way to remove the random characters appended to Gallery Custom URLs?

$
0
0
When I use the API 1.2.2 to create a stack of three folders and a gallery at the bottom, I get this for the gallery's Custom URL like this one:

http://idtech.smugmug.com/POMONA/IDT...82014/n-bvD2j/

When created manually will all the same container names, you get this Custom URL:

http://idtech.smugmug.com/POMONA/IDT...4August082014/

The user doesn't like the random characters that are appended to the gallery URL when the API creates it.

Here are my questions:
  1. Is the random characters being added because all Album.NiceNames must be unique regardless of the folder structure?
  2. Is there anyway to prevent the random characters when creating a gallery via the API?
  3. Is there anyway to remove the special characters after it is created?

smugmug.reflection.getMethods

API v1.3 - Need help with finding into on a specific album

$
0
0
hi there!

I was wondering if there's a faster and efficient way of doing this: I have the ID of a spacific album and I need to get its into and images to display on my external site.

Currently I use albums_get() to fetch all albums then I loop through to find the particular album byt checking each album's ID inside the loop. Once found I break and get its images.

This is very inefficient and slow as I need to load all album info just to find one. and it slows down the page load significantly. Could you let me know if there's a better way to do this? eg. album_get('$AMBUM_ID'| '$ALBUM_KEY) ?

Thanks very much!

Searching a specific album

$
0
0
In reading on the API 2.0 thread I found this http://api.smugmug.com/api/v2/image!search

Is it possible to restrict the search to a particular folder? I have events that where I tag competitors by bib number and allow them to search for themselves. Obviously bib numbers repeat across events so when I search I need to restrict to a specific event. I'd like to play with the api to do this instead of my current solution.

Any advice?

Thanks!

API 1.3 authentication

$
0
0
I'm working on a proof of concept where I need to be consume our user's albums and get the image meta data. I know the api will let me do this, but where I'm having an issue is that I'm using a thick-client (AngularJS) which basically means I'm almost entirely in javascript.

oauth 1.0 is particularly insecure for a pure javascript implementation as you have to store the api key and the secret in code which is easily viewable by anyone who has a basic understanding of javascript.

Basically I really want it just read only access to my albums and to be able to pull image information. Is there a better way for me to do this?

Is there a way to get a list of photos with thumbs up by album name?

$
0
0
Is there a way to get a list of photos with thumbs up (and how many) by album name?

I checked through the 1.3.0 API and nothing stood out to me. I saw someone had the parameter, "SortBy=popular" in a somewhat-related post, but wasn't able to get it to work myself. Thanks for any help!

Plug In for CaptureOne?

$
0
0
Is anyone working on (or is there already) a plugin to export directly and sync with smugmug? Like I can do in Lightroom? If not what would it take?

Windows store app and creating authenticatino cookie

$
0
0
I'm building a windows store app using smugmug api and one issue I'm having is after the user logs in via Oath and navigates around the app (similar to website), I'm not able to display the images because using the Url returned by api does not work directly. I understand this is by design, I'm sending an unauthenticated http request and the images require user to be logged in. Is there a way I can appropriately generate the necessary cookie to attach to the http requests to allow logged in users to view photos via http ?

How to do HTTPS upload?

$
0
0
Hi,

I've been working on some code (in C) for uploading and got most of the prototype working happily. I can get list of albums and upload images to an album of choice. I use OAUTH and v1.3.0 of the API. It works on both http and https with one exception. The uploads don't work on HTTPS. It appears the server upload.smugmug.com don't allow connections to the HTTPS port (443).

Is upload.smugmug.com supposed to work over HTTPS? If not, is there another way to securely upload images to smugmug?

Cheers!
/P

Reference http://api.smugmug.com/services/api/?method=upload

Setting password using 1.3 API (new SmugMug) broken

$
0
0
There appears to be an issue creating a password protected gallery on the new SmugMug with the 1.3 API. The gallery is created successfully but the password does not work and has to be set manually on the website. The request works correctly on a site in the old SmugMug mode - the password is set correctly and works as expected. The same code and request sequence does not set the password correctly on the new SmugMug.

This is some debug output showing the URL used to create the gallery and the JSON response returned indicating success.

Request:
<OAMutableURLRequest: 0x608000898600> { URL: http://api.smugmug.com/services/api/...areThumbs=true }

Response:
{
Album = {
Key = gMNPFr;
id = 44310593;
};
method = "smugmug.albums.create";
stat = ok;
}

A fix would be nice or a workaround if there is one.

An example (non-working) gallery is at:

http://rclportfolio.smugmug.com/Testing-1/Test5/n-GJmzj

The password should be pass123.

Thanks
Richard Laing

smugmug.images.getInfo


Need video640URL in API 1.3.0, can't find them

$
0
0
Quote:

Originally Posted by devbobo (Post 695768)
yeah, i'm a bit lagged on this, i'm actually working on it atm.

i'm adding the following parameters (if they exist)...

- Video320URL
- Video640URL
- Video960URL
- Video1280URL

Cheers,

David

Hi,

I couldn't find these fields in API 1.3.0, I need them, what should I do?
I am using
https://secure.smugmug.com/services/...s.get&AlbumID=....
Can anyone help me in this?

Thanks.

Malformed redirect link

$
0
0
I'm having issues downloading videos via the API. When I make the download request using the video's url, I get a 302 http code in the response and 'X-Smug-RedirectTo' field in the header. Following the redirect link in the header gives me a 'Could not connect:<url> malformed' error. After inspecting the redirect link I noticed it was only a relative path to the file and did not include the host. What do I need to prepend/append to the redirect link to get the full url? Any help on how to handle this would be greatly appreciated

Facial Recognition Write-up

$
0
0
So I am just starting to upload all of my personal and family pictures to SmugMug. At first I figured it would be a fairly simple process aside from the huge draw on my internet connection. I soon realized that if I wanted to keep my massive picture collection organized and easy for others to view I would have so put a fairly significant amount of work into the project compared to what I originally thought.

I would like to share what I have found under the subject of tagging pictures with peoples faces who appear in them and being able to view that information in SmugMug.

Software versions:
Windows 8.1, Picasa 3 (3.9.138 Build 151 if anybody really cares), "The New SmugMug" (2014)

I used Picasa for all of the heavy lifting when it came to identifying the faces in pictures and pairing them with names. The process is not perfect but it is the simplest easiest way that I have found. I also just let Picasa keep all of the information for each picture in the ".picasa.ini" file they insert into every folder. This is what the tagging program I used reads in order to tag each individual picture.

There is a significant gap between Picasa and actually getting the keywords to show up after uploading to SmugMug. SmugMug says, "SmugMug will recognize any metadata in the standard EXIF/IPTC caption/keyword/title fields."

Here is my solution:

Download the latest version (1.7 at time of writing) of the simple executable progrm "AvPicFaceXmpTagger" here: http://www.anvo-it.de/wiki/avpicfacexmptagger:main

Open the program, make sure you are on the "Tagging" tab, under "Tagging Options" make sure the only single box that is checked is in the "IPTC-Keyword Tags" section under "Step 2: Add tags" called "Picasa face name". This will write the face names you set in Picasa to the IPTC medadata for each picture. Next you will add the files to the list by either going through the "File" menu or dragging and dropping into the appropriate area. For the sake of keeping things simple and organized I only process one folder at a time. Now you can "START Tagging".

This is not quite the end though. I did have a significant bit of trouble in getting my face tags to show up in the SmugMug keywords even though they showed up perfectly fine in windows explorer in the details pane under "Tags:". At this point after you have tagged the pictures I have found that for some reason they aren't always completely saved to the actual IPTC metadata yet, or at least they are not recognized by SmugMug after uploading.

The final step before uploading is to select all of the individual pictures at once in the folder you are working with through windows explorer and in the "Tags:" field either add a tag and save or remove a tag and save or both, you just have to do something that requires saving. This will cause the name tags added from Picasa to be written in a way that SmugMug will recognize.

I know this seems pretty long and involved and I would bet some people may have better methods based on their workflow but it really isn't too bad after you go through a couple iterations. I would definitely suggest this method for adding keywords prior to uploading to SmugMug if you don't already have a defined workflow and want to start face tagging.

I would welcome any suggestions or shortcuts anybody might come across.

Image key and id

$
0
0
Many years ago I wrote some code (wordpress plugin) to be able to get different sizes of an image so I could use it in a "lightbox effect". The idea was that I would get the key/id to an image and fetch the proper size for the theme (configured in the plugin) and the large image. I don't remember exactly how it looked but using something like

Code:

[smug key="bla" id="id" caption="blipp]
the plugin would generate something like this

Code:

<a href="large image url"><img src="small image url" /></a>
(it was a bit more complicated with formatting of captions, alignments, gallery etc).

I would like to do something similar again but this time obey all the rules :D . So, I can see that I should use the API and get the proper URL using smugmug.images.getURLs instead of creating them myself. But how do I get the ID/Key? It doesn't look like I can get them from the image URL (in the share panel) anymore.

Or does someone have a better way of solving the whole problem? (much preferred :D )

Invalid signature error using smugmug.subcategories.create

$
0
0
Hello All,

I am trying to create subcategory inside "Others" Category of SmugMug using API 1.3.0. Its throwing me "Invalid Signature" error. I am using the same method of signing for other request which gets executed successfully. Now I am unable to figure it out where I am going wrong!:dunno

This is my request url
Here is my Base String :-
Quote:

GET&https%3A%2F%2Fapi.smugmug.com%2Fservices%2Fapi %2Frest%2F1.3.0%2F&CategoryID%3D45663115%26method% 3Dsmugmug.subcategories.create%26Name%3Dprerana%26 oauth_consumer_key%3D1WcKTxQH2fegQTF0C7cVAORjeoTSD 68V%26oauth_nonce%3D2379299%26oauth_signature_meth od%3DHMAC-SHA1%26oauth_timestamp%3D1415859474%26oauth_token% 3Dc5c2612d398c0c26c443c2aa53733b08%26oauth_version %3D1.0
Here is my actual api call along with signature :-
This is error what I get after executing it :-

Quote:

<?xml version="1.0" encoding="utf-8"?>
<rsp stat="fail"><method>smugmug.subcategories.create</method><err code="35" msg="invalid signature"/></rsp>
I am completely at my wits end on this issue and unable to track it down. My app production has hit a roadblock because of it:cry

Any help or pointers will be great. Thanks a ton in advance!

-Prerana
Viewing all 147 articles
Browse latest View live