Forums | Admin

Discussion Forums: help

Start New Thread Start New Thread

 

By: Oliver Kohl
RE: sample code for homepage integration [ reply ]  
2006-02-14 22:31
Hi Trevor,

thanks for your reply. Doesn't matter if your late, i'm too;)

First, the photos belong to my flickr account and i've marked them as private. I want to show the photos on my website only to users, that have the proper authorization.

This is from my GalleryController:
(Please be gentle because i'm a rails rookie!)

class GalleryController < ApplicationController
layout "standard-layout"
APPLICATION_KEY = 'xxx'
SHARED_SECRET = 'xxx'

def index
@flickr = Flickr.new("/.flickr-token",APPLICATION_KEY,SHARED_SECRET)
if @flickr.auth.token == nil
render :action => 'get_frob'
else
@flickr.auth.getToken
@flickr.auth.cache_token
end
end

# This is set as my my Callback in Flickr
def show
# Here @flickr is already null
if @flickr
@flickr.auth.frob = @params["frob"]
@flickr.auth.getToken
@flickr.auth.cache_token
end
end

def get_frob
end
end

My first problem is how do i set the correct path to my token? I'm in a windows enviroment. Where should i put my token and how do i specify the path to it in the code?

The callback url at flickr is set to /gallery/show, but when show is entered, @flickr is null and i can't set the frob.

What do i'm missing?

Thanks,
Oliver

By: Trevor Schroeder
RE: sample code for homepage integration [ reply ]  
2006-02-12 03:47
Sorry for not seeing this until now, I'm a little snowed under in email.

If the photos are not public, there's no way to avoid asking the user to authorize. If they're all your photos, though, only you need to authorize your application.

Could you provide code showing how you're trying to access Flickr?

Once you've authorized your app, it should be fairly straightforward. Simply create a new Flickr instance with your API key, secret, and pointer to your token cache.

Flickr.new(TOKEN_CACHE, KEY, SECRET)

By: Oliver Kohl
sample code for homepage integration [ reply ]  
2006-02-10 13:30
Hi,

thanks for providing a nice api to flickr.

I'm new to ruby/rails but want to use your lib for diplaying my (private/family) flickr photos in my homepage. This should be done without nagging the user to click a link for authorization. I have done some coding but but i can't access my @flickr object after making the flickr round for authorization (object == null).

Maybe you could provide some sample code how to include your lib in an existing webpage?

Thanks in advance,
Oliver