I'd like to see photosets.getPhotos implemented to return all the photos from a photoset. Patch attached that will add that function.

It could be useful in many ways. I'm using this in a CCK Flickrfield module that allows you to input a photo or photoset id and retrieve the photo, the photoset primary photo, or all photoset photos to display in the field (I'm submitting that module in a separate issue).

Comments

drewish’s picture

here's a re-roll that updates some of the other andrew's code in the sets module to use the function.

drewish’s picture

StatusFileSize
new3.77 KB

here's the patch...

andrewlevine’s picture

Status: Needs review » Reviewed & tested by the community
StatusFileSize
new3.69 KB

your re-roll looks good to me except for the fact that you are leaving the $set_response variable in there unused. am i missing something? My re-re-roll adds these lines to the patch:

-  $set_response = flickr_request('flickr.photosets.getPhotos', 
-    array(
-      'photoset_id'=>$set_id,
-      'page' => $pager_page_array[$element]+1,
-      'per_page' => variable_get('flickr_photos_per_page', 20),
-     ));

I am setting this RTBC for you to commit. thanks KarenS and drewish...

drewish’s picture

Status: Reviewed & tested by the community » Needs work

i'd like to clean up some of the PHPDoc before we commit this.

karens’s picture

Assigned: karens » Unassigned

I'm unassigning myself for now, but still interested in this idea.

Egon Bianchet’s picture

Status: Needs work » Needs review
StatusFileSize
new3.66 KB

Rerolled latest patch, for Drupal 5.

glass.dimly’s picture

I applied the patch but it didn't get any more than one photo. Perhaps I am doing something wrong.

Great idea, I hope somebody smarter than me can make it work.

Also, double parenthesis in line 148 spits a syntax error.

thanks,
jmjohn

Shai’s picture

I couldn't get the patch to apply cleanly at all. But I updated the files "by hand." But like #7, I still just get 1 image using the input filter for sets.

ao2’s picture

Any update for drupal 6?

See also http://drupal.org/node/262591

Thanks,
Antonio

soxofaan’s picture

StatusFileSize
new3.8 KB

I worked a bit on the patch of #6:
- fixed syntax error reported in #7
- there were some bugs in the refactoring (forgotten translation of $set_response['photoset'] to $photoset)
- worked a bit on PHPdoc

patch works on my setup

At glass.dimly and Shai: the patch does not change the behavior of the input filter for sets, there is only some refactoring under the hood. It's invisible above the surface, but it should make it simpler to implement your feature request.

Anonymous’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev
Assigned: Unassigned »
Anonymous’s picture

coming back to this after we have released a stable 1.0 version of this module

Anonymous’s picture

Would you provide a recent patch for review.

Best, Paul

Anonymous’s picture

Title: Implement photosets.getPhotos » [AWAITING RECENT] Implement photosets.getPhotos
soxofaan’s picture

StatusFileSize
new5.57 KB

This one should do it

soxofaan’s picture

Title: [AWAITING RECENT] Implement photosets.getPhotos » [UPDATED PATCH AVAILABLE] Implement photosets.getPhotos

(title update)

ksenzee’s picture

Status: Needs review » Fixed

As best I can tell this has been committed. If I'm wrong please feel free to reopen.

ksenzee’s picture

Status: Fixed » Needs review

Oops, wrong issue. Sorry.

I'm reviewing this and I think it's a good idea. I'm holding off on committing it until I get through some of the rest of the issue queue, to make sure it doesn't adversely affect anything else in the queue.

drewish’s picture

Title: [UPDATED PATCH AVAILABLE] Implement photosets.getPhotos » Implement photosets.getPhotos

fixing the title. we use the status field to indicate that there's a patch.

didn't try applying the patch but aside from some indenting issues it looks okay to me.

tiyberius’s picture

So could someone tell me how we take advantage of this feature? I don't see it anywhere in the settings (I'm looking in the "Display Fields" option for a content type that has a flickr field). If we could recap and just go over how we display all the photos from a set, that'd be great!

Anonymous’s picture

Just had quick look at the patch and can see that your suggesting a broader
wrapper around flickr.photosets.getPhotos ..

function flickr_photoset_get_photos($photoset_id, $page = 1, $per_page = NULL) {
  if (!isset($per_page)) {
    $per_page = variable_get('flickr_photos_per_page', 20);
  }

  $response = flickr_request(
    'flickr.photosets.getPhotos',
    array(
      'photoset_id' => $photoset_id,
      'page' => $page,
      'per_page' => $per_page,
    )
  );
  if ($response) {
    return $response['photoset'];
  }
  return FALSE;
}

.. as an alternative to ..

function flickr_set_load($sid, $page = 1) {
  // TODO: Not sure why this called for /flickr and does not show for admin role
  if (is_numeric($sid)) {	
    return flickr_request('flickr.photosets.getPhotos',
    array(
      'photoset_id' => $sid,
      'page' => $page,
      'per_page' => variable_get('flickr_photos_per_page', 20),
    )
    );
  }
}

.. to accomodate $per_page and better naming for the wrapper function and that flickr_set() becomes a wrapper
around flickr_photoset_get_photos for default arguments.

Looks goods.

Would you mind rolling the patch again against the latest version in development and i'll review promptly.

Best,
Paul Booker
Appcoast

ccoppen’s picture

It only works under the user accounts. There should be a default setup for this, but for now, it seems to only work under the user accounts.

I went to my admin account and put the default Flickr account id in there.

Then you got to http://sitename/flickr/1/sets and you'll see all the sets.

There needs to be a way to view all sets from the default flickr settings, such as http://sitename/flickr/sets/

lolandese’s picture

Issue summary: View changes
Status: Needs review » Fixed

Cleaning up the issue queue.

A quick search revealed the following that indicates that the OP's request somehow got through:

Searching 22 files for "flickr_photoset_get_photos"

/home/martin/www/drupal-6/sites/all/modules/flickr/block/flickr_block.module:
  253    }
  254  
  255:   $repsonse = flickr_photoset_get_photos($photoset_id);
  256  
  257    if (!$response) {

/home/martin/www/drupal-6/sites/all/modules/flickr/flickr.api.inc:
  124   *   (http://www.flickr.com/services/api/flickr.photosets.getPhotos.html)
  125   */
  126: function flickr_photoset_get_photos($photoset_id) {
  127    $response = flickr_request('flickr.photosets.getPhotos',
  128    array(

2 matches across 2 files

Searching 22 files for "flickr.photosets.getPhotos"

/home/martin/www/drupal-6/sites/all/modules/flickr/flickr.api.inc:
  121   *
  122   * @return
  123:  *   response from the flickr method flickr.photosets.getPhotos
  124:  *   (http://www.flickr.com/services/api/flickr.photosets.getPhotos.html)
  125   */
  126  function flickr_photoset_get_photos($photoset_id) {
  127:   $response = flickr_request('flickr.photosets.getPhotos',
  128    array(
  129      'photoset_id' => $photoset_id,

/home/martin/www/drupal-6/sites/all/modules/flickr/sets/flickr_sets.module:
   33    // TODO: Not sure why this called for /flickr and does not show for admin role
   34    if (is_numeric($sid)) {
   35:     return flickr_request('flickr.photosets.getPhotos',
   36      array(
   37        'photoset_id' => $sid,

4 matches across 2 files

It is used by the submodules Flickr Sets, Flickr Field (if Flickr Sets is enabled) and Flickr Block for the 'Random photos from a set' block.

The output of 'git log -p' shows that the following commit implemented 'flickr.photosets.getPhotos' the first time.

commit aebd6934be9944cb74bc54874830c55c0a082e02
Author: Andrew Levine <arl@andrewrlevine.com>
Date:   Thu May 10 03:49:43 2007 +0000

    #112438 adding photoset support

It refers to a D5 issue #112438: Add full photoset functionality.

Feel free to reopen if necessary.

Thanks.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.