×

Discussion Board

Results 1 to 10 of 10
  1. #1
    Registered User
    Join Date
    Oct 2012
    Posts
    120

    I hvae built s40 web application PhotoAlbum.I want to use my flickr api key

    I have built s40 web application PhotoAlbum.I want to use my flickr api key which I got online from flickr.com.


    When I run the application I want to show or see the flickr photos uploaded already in my account.



    Please help me. I have inserted the flickr key already like


    (function(){
    jsonFlickrApi = function(results){
    //flickr_webapp.splash(results.photos.photo[0]);
    flickr_webapp.splash(results);
    }
    flickr_webapp = function(){
    var _w,_d,_h,_s,_g,_s,_imgs,_focus; //function scoped vars
    var _BUFFER = 60; //number if images to cache
    var _PER_PAGE = 15; //number to scroll through
    var THUMB_IMG_URL = "http://farm${farm}.static.flickr.com/${server}/${id}_${secret}_s.jpg";
    var LARGE_IMG_URL = "http://farm${farm}.static.flickr.com/${server}/${id}_${secret}_m.jpg";

    // !!!
    // NOTE! You must apply for a Flickr API key from http://www.flickr.com/services/api/misc.api_keys.html
    // and insert it below
    var API_KEY_FLICKR = "[63e940334a5e25d7c8fa14128371ae02]";// my flickr AP i key


    /**
    * Initialization function, sets up variables and requests the landing page image.
    *
    * @param {HTMLElement} container The href value from the base tag.
    * @param {String} reqUrl The URL that should be requested
    * @returns {String} The useable base URL
    * @private
    **/
    function _init(container){
    _d = document;
    _h = _d.getElementsByTagName('head')[0];
    _w = {'preferences':{'searchText':'Nokia'}};
    _d.getElementById('search-input').value = _w.preferences.searchText;
    _g = container;
    var rand = Math.floor(Math.random()*100);// my flickr AP i key
    if ((API_KEY_FLICKR == "[63e940334a5e25d7c8fa14128371ae02]") || (!API_KEY_FLICKR.length) ) {
    document.getElementById('title-bar').innerHTML = 'Flickr API key is needed.';
    }else{
    _query_flickr("http://api.flickr.com/services/rest/?method=flickr.interestingness.getList&api_key=" + API_KEY_FLICKR + "&format=json&page=" + rand + "&per_page=1");
    }
    }

    function _generate_string(template,values){
    return template.replace(/\$\{([\w-]+)(?:\[\w\.]*)(?:\((.*?)?\))?)?\}/g,function(m,name){
    return values[name] !== undefined ? values[name] : "";
    });
    }

    function _splash(results){
    if (results.photos.photo.length > 0) {
    bg_pic = results.photos.photo[0];

    if (bg_pic != undefined) {
    _d.getElementById('splash').style.backgroundImage = 'url(' + _generate_string(LARGE_IMG_URL, bg_pic) + ')';
    }
    }
    //re-purpose global API callback to handle search
    _overwrite_callback(function(results){
    _parse_response(results.photos.photo)
    });
    }


    function _overwrite_callback(fn){
    jsonFlickrApi = fn;
    }
    function _clear_node(n){
    while (n.hasChildNodes()){
    n.removeChild(n.lastChild);
    }
    }


    function _render_grid(){
    var x = 0;
    for (p in _imgs) {
    if (p >= _focus && p < (_focus +_PER_PAGE)) {
    var s = _d.createElement('span')
    if (_imgs[p] != undefined) {
    a = _d.createElement('a');
    a.setAttribute('onclick', 'flickr_webapp.loadPic(' + p + ')');
    img = _d.createElement('img');
    img.setAttribute('src', _imgs[p]['thumb']);
    img.setAttribute('width', '80');
    img.setAttribute('height', '80');
    img.setAttribute('class', 'thumb');
    s.appendChild(a).appendChild(img);
    }
    else {
    img = _d.createElement('img');
    img.setAttribute('src', 'img/spacer.gif');
    img.setAttribute('width', '80');
    img.setAttribute('height', '80');
    s.appendChild(img);
    }
    _g.appendChild(s);
    }
    }
    }


    function _load_pic(index){
    _focus = index;
    _clear_node(_d.getElementById('zoom-container'));
    var table = _d.createElement('table');
    var row = table.insertRow(0);
    table.setAttribute('cellspacing',0);
    table.setAttribute('cellpadding',0);
    _insertZoomedCell(row, index-1)
    _insertZoomedCell(row, index)
    _insertZoomedCell(row, index+1)

    _d.getElementById('zoom-container').appendChild(table);

    mwl.switchClass('#zoom-container','zoom*','zoom2');
    mwl.setGroupTarget('#search-button','#grid','visible','hidden');
    mwl.setGroupTarget('#content', '#zoom', 'visible', 'hidden');
    }

    function _slide_left(){
    mwl.setGroupTarget('#arrow-button','#set2','visible','hidden');
    _load_pic(_focus - 2);
    }

    function _slide_right(){
    mwl.setGroupTarget('#arrow-button','#set2','visible','hidden');
    _load_pic(_focus + 2);
    }

    function _insertZoomedCell(row, index){
    var cell = row.insertCell(row.cells.length);
    div = _d.createElement('div');
    div.setAttribute('class','zoom-pic');
    div.style.backgroundImage = 'url(' + _imgs[index].large + '?d=' + new Date().valueOf() + ')';
    cell.appendChild(div);
    title = _d.createElement('div');
    title.setAttribute('class','title');
    title.innerHTML = _imgs[index].title;
    div.appendChild(title);
    return cell;
    }

    function _query_flickr(url){
    if (_s != undefined) {
    _h.removeChild(_s);
    }
    _s = document.createElement('script');
    _s.type = 'text/javascript';
    _s.src = url;
    try { // Chec if there's problem in adding the content in DOM header
    _h.appendChild(_s);
    } catch (e) {
    no_results();
    }
    }
    function _no_results() { // In case of search fails / no results available
    document.getElementById("grid-container").innerHTML = "No results";
    }
    function _parse_response(photos){
    var num_results = photos.length;
    if (num_results > 15) {
    _focus = Math.round(num_results/2);
    _imgs = {};
    for (p = 0; p < photos.length; p++) {
    _imgs[p] = {
    'title': photos[p].title,
    'thumb': _generate_string(THUMB_IMG_URL, photos[p]),
    'large': _generate_string(LARGE_IMG_URL, photos[p])
    };
    }
    _render_grid(_imgs);
    }else{
    no_results();
    //alert('No results found.');
    }
    }

    function _search(){
    //establish interface
    _clear_node(_g);
    mwl.setGroupTarget('#content','#grids','visible','hidden');
    //get/validate search string
    var text = text || _d.getElementById('search-input').value;
    if (text.length != 0) {
    _w.preferences['searchText'] = text;
    _query_flickr("http://api.flickr.com/services/rest/?method=flickr.photos.search&api_key=" + API_KEY_FLICKR + "&format=json&page=1&per_page=" + _BUFFER + "&text=" + text);
    }
    }

    return {
    init:_init,
    search:_search,
    splash:_splash,
    loadPic:_load_pic,
    slideLeft:_slide_left,
    slideRight: _slide_right,
    parse_response:_parse_response
    }
    }();
    if(typeof window.addEventListener !== 'undefined') {
    window.addEventListener('load', function() { flickr_webapp.init(document.getElementById('grid-container')); }, false);
    }else if(typeof window.attachEvent !== 'undefined') {
    window.attachEvent('onload', function() { flickr_webapp.init(document.getElementById('grid-container')); });
    }
    } )();




    Please help me by suggesting me the proper code and / url and place whre it is to be inserted.

  2. #2
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: I hvae built s40 web application PhotoAlbum.I want to use my flickr api key

    Basically, as said multiple times, we here are not meant to design & implement your applications. Indeed you do need to do that by yourself.

    Do do debug and see what is going on with your code, and what happens and what does not. then if you have identified an problem from there which you would not know any solution, then ask again.

    If you want other to do all the work, then you should consider outsourcing the development of the application. Unfortunately we here do not offer services for that.

  3. #3
    Registered User
    Join Date
    Oct 2012
    Posts
    120

    Re: I hvae built s40 web application PhotoAlbum.I want to use my flickr api key

    Ok Yucca I have already been to the code.flickr


    http://www.flickr.com/services/api/

    Iam canfused about what code to use and where thats all ...

    I have already inserted the flickr key.


    The photoalbum application info is at :


    https://www.developer.nokia.com/info...m_Example.html

  4. #4
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: I hvae built s40 web application PhotoAlbum.I want to use my flickr api key

    Basically Flickr is not Nokia service, thus can you please check the docs what they have in their site, I'm certain they do explain how their service is supposed to be used.

    Then see, what irrationalities of it you want to add to your application, and then see what problems you have when you start implementing the codes in your app.

  5. #5
    Registered User
    Join Date
    Nov 2010
    Posts
    1,169

    Re: I hvae built s40 web application PhotoAlbum.I want to use my flickr api key

    Yucca you r right. I have searched the documents at the page below:
    http://www.flickr.com/services/api/

    But there is no proper code or material found for s4o or symbian application.

  6. #6
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: I hvae built s40 web application PhotoAlbum.I want to use my flickr api key

    So then you should define what excat problem you are having, and how have you so far tried solving it. What did you expect to happen and what instead happened.

    Or if you are missing API, then do descripe the use case in details.

    Note that this section is for S40 WEb apps, so S40 Java questions, or anything realted to Symbian should be asked in separate thread.

  7. #7
    Registered User
    Join Date
    Oct 2012
    Posts
    120

    Re: I hvae built s40 web application PhotoAlbum.I want to use my flickr api key

    No my specific problem is related to s40 web application only.

    I want to show photos uploaded in my flickr.com account by building an application similar to PhotoAlbum which is already described here:


    https://www.developer.nokia.com/info..._Album_Example.

  8. #8
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: I hvae built s40 web application PhotoAlbum.I want to use my flickr api key

    so your use case is I want to show photos uploaded in my flickr.com account by building an application similar to PhotoAlbum which is already described here:

    So, what have you do so far, and what kind of problems you are having ?

  9. #9
    Registered User
    Join Date
    Oct 2012
    Posts
    120

    Re: I hvae built s40 web application PhotoAlbum.I want to use my flickr api key

    just inserted my flickr api key in " flickr-webapp.js" as said in the document

  10. #10
    Nokia Developer Expert
    Join Date
    Mar 2003
    Location
    Lempäälä/Finland
    Posts
    29,143

    Re: I hvae built s40 web application PhotoAlbum.I want to use my flickr api key

    So, then see what you can do with the js-file, which parts of the functionality you want to use from it in your application.

    And then see how you can integrate those parts into your own application.

Similar Threads

  1. Qt flickr?
    By aparna.sr.14 in forum Qt
    Replies: 1
    Last Post: 2010-06-29, 10:56
  2. Using PhotoAlbum!!!! Please Help!!
    By felipeok in forum Symbian User Interface
    Replies: 0
    Last Post: 2004-10-22, 20:55
  3. display specific picture in PhotoAlbum
    By sopta007 in forum Symbian User Interface
    Replies: 0
    Last Post: 2004-01-26, 15:39
  4. How can I Creat Icons in PopupList Form Thumbnails in PhotoAlbum?
    By schematic in forum Symbian Tools & SDKs
    Replies: 1
    Last Post: 2002-12-18, 02:06
  5. Running J2ME Project PhotoAlbum in 7650
    By raymondyau in forum Mobile Java General
    Replies: 0
    Last Post: 2002-10-08, 02:34

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •