Hi, First off, this looks like a really great module and if I can get it doing what I want it to do it's really going to help me out a lot on this site I'm building.

I'm using Flickr Attach 6.x-1.3 with Flickr 6.x.1-1 on my Drupal 6.10 install. I did a fresh update this morning of all my modules so I really should be running the latest version of everything.

I've got Flickr Attach installed and set up and what not, I see the fieldsets when I go to edit my nodes, but I can't get anything to actually display. I know on the project page you refer to $node->photos and $node->sets but either I'm too much of a newb to know how to get those objects to work or I don't know. I've used the devel module to display the objects in the $node array but can't find anything named photos or sets. I find an object called flickr_attach but it doesn't really seem to contain the info that I'm looking for to display a flickr photo set or anything.

I would really appreciate it if more details on how to use $node->photos and $node->sets could be provided. This looks like a great module but unfortunately I can't do anything with it :(

Comments

AaronBauman’s picture

Right - so i think its mentioned somewhere in the caveats that this module does not actually display anything....
Indeed -- looks like i forgot to update the documentation on the module page to reflect the updates to flickr_attach nodeapi.
I'll take care of that asap.

Anyway, here's how it works:
when your flickr-attached node gets loaded, flickr_attach populates this array property of your node, flickr_attach.
that's $node->flickr_attach.

Indexed by flickr_attach are the data element(s) for the image and/or set that flickr module needs to theme any flickr image.
that's $node->flickr_attach['image'] and $node->flickr_attach['album'].

you can pass either one of these elements to the theme_flickr* functions to get something to display.

Here's an example of how i use this module to display the flickr-attached-image of a node in a block:

function my_module_block($op = 'view', $delta = 0, $edit = array()) {
  switch($op) {
    case 'info':
          return array('info' => "NODE --> FLICKR : IMAGE attachment");
          break;
    case 'view':
      $nid = is_numeric(arg(1)) ? arg(1) : null;
      if(!$nid || arg(2) == 'edit') { return; }
      $node = (object)array('nid' => $nid);
      if(!function_exists('flickr_attach_initimages')) { return null; }
        flickr_attach_initimages($node);
        if(empty($node->flickr_attach['image'])) {
          break;
        }
        $image = $node->flickr_attach['image'];
        return array(
          'subject' => false,
          'content' => theme('flickr_photo_box', $image['data'], 'm'),
          );
      break;
  }
}

Please let me know if that makes sense, or if you have another use case that i can help you address.

thatpatguy’s picture

Hi aaronbauman,

Thanks for the quick response! I was aware from the caveat on the project page that this modules doesn't display anything, my issue was the out of date flickr_attach node api :) Thanks for clarifying, it's what I figured but I felt it was good to check :)

Also, thanks for the code snippet. I'm working on embedding photos from a photo set into a node, but your example is still useful. Thanks again, and great module!

AaronBauman’s picture

Status: Active » Closed (fixed)

sure thing.
I'm currently working on some more documentation, as well as support for individual drupal user flickr accounts.
right now only the master Flickr User Id is supported.
And given the questions / issues that have been filed so far, I'll probably include some sample blocks as well.

Also - check out this related issue and patch(es) which has snagged some folks: #437116: admin/settings/flickr: Username not replaced with User Id

thatpatguy’s picture

I was able to set this up so that it worked exactly the way the client wanted. I'm using this module to allow the client (who has very little technical knowledge) to easily attach flickr galleries to individual nodes. I'm then using a couple of jQuery plugins to display images from the selected gallery. This ultimately allows the client to use Flickr to host their images, but have them display on their site like they were hosted on their site.

I would be happy to post code snippets to show how I set this up if you, or anyone else, is at all interested in what I did. Unfortunately the site isn't live yet so I can't show a demo, but it should be pretty obvious how it will display even without a demo.

AaronBauman’s picture

If you'd like to post some snippets that could be applicable/helpful to others (ie. not site specific), i'm sure it could help some folks out, and i'll be happy to include them in the example code / module documentation.

pieterdt’s picture

it is also very easy to use contemplate for your node design to show your images or sets.

I created a content type which is empty but uses flickr_attachments.

Next a create a template for that content type

in the template I check the box to modify the body

in the template i pput:

<?php
$owner = array('nsid' => FUID);
print theme('flickr_photoset',$node->flickr_attach['album']['data'],$owner , 't');
?>

that's it. When viewing your node now, you will see all pictures in the flickr set.

AaronBauman’s picture

FYI: i've added these examples and some other documentation, as well as a couple user messages around enabling / configuring flickr_attach to HEAD.

glennnz’s picture

Hi

I'm keen to see how I can display a single random image from a Flickr set in a node template.

Thanks

Glenn

AaronBauman’s picture

Glenn,
I believe flickr blocks module (part of the flickr package) provides facility for this via a block ("Flickr random photo from photoset" or something).

If you need tighter control over which image or which set is displayed,
you should implement hook_nodeapi (or hook_block, or whatever suits your case) to examine the node's flickr_attach property and query flickr for a random image of any existing set. That would be something like: 1) figure out how many images in the set, 2) grab image n where n is a number less than or equal to the number of images in the set.

I think flickr blocks module will be suitable for your case, but if not, check out how it's implemented in modules/flickr/block/flickr_block.module. the function is "_flickr_block_random"

AndrewJames’s picture

Hi,

I'm new to drupal and wondered if theres a how to for displaying flickr albums/images using this module?

At present I can see the albums/images but when I associate them with the post they don't display. I know this is a function of the module but is there a "beginners" how to so I can see them?

Thanks

Andrew

AaronBauman’s picture

The thread above outlines two different ways to use this module (#1 and #6).

If you don't want to build a module and implement a block, or you don't want to edit themes,
then flickr module will provide you with the tools you need.

glennnz’s picture

Aaron

Thanks. I think I needed to be a little clearer.

I have a content type 'River'. In Flickr, I have a bunch of images for each particular River, that are organised into a set for each rifver.

In my node for that River, I want to display a random image from the particular set of photos for that river.

I'm trying to use Contemplate to achieve this.

Thanks for any advice.

Glenn

glennnz’s picture

Pat

Some help here would be great. I'm just trying to get a single random image from the node's attached album to display, see comment #12.

Thanks

Glenn

nosro’s picture

Please do post your snippets, I would like to do exactly what you describe. I'll go looking for jQuery flickr plugins, perhaps I'll find what worked for you.

juropel’s picture

Hi thatpatguy,

Could you provide more detail on how you accomplished this?

_What jQuery plugins are you using? Have you tried Galleria or Views Galleria?
_What code did you you have to insert?

Thanks much!