samtiria / nextgen-gallery

Automatically exported from code.google.com/p/nextgen-gallery
0 stars 0 forks source link

XMLRPC method to return information for a specific image #455

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Alex, could you add a few XMLRPC methods to request information for a single 
object:

ngg.getGallery
  - int blog_id
  - string username
  - string password
  - int gallery_id

ngg.getAlbum
  - int blog_id
  - string username
  - string password
  - int album_id

ngg.getImage
  - int blog_id
  - string username
  - string password
  - int gallery_id
  - int picture_id

In situations where I need to check if a particular gallery or a particular 
image still exists on the server, this would greatly improve performance. This 
would also make the XMLRPC API more complete :)

Thanks in advance!
Vladimir

Original issue reported on code.google.com by v...@alloyphoto.com on 5 Jan 2012 at 4:44

GoogleCodeExporter commented 8 years ago
If you want I can write the code for these new methods myself, and you would 
just review and incorporate my changes in xmlrpc.php. Please let me know.

Original comment by v...@alloyphoto.com on 5 Jan 2012 at 4:47

GoogleCodeExporter commented 8 years ago
Yes, that would be great. Just add it as patch or file, I will look into it

Original comment by alex.cologne on 5 Jan 2012 at 6:33

GoogleCodeExporter commented 8 years ago
Alex, attached is the updated xmlrpc.php file. I also needed to make a minor 
change in the ngg_db.php file so the find_gallery() method also returns the 
number of pictures in the gallery:

insert on line #195 (after line $gallery->galdesc  = 
stripslashes($gallery->galdesc);):

$gallery->counter = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(*) as counter 
FROM $wpdb->nggpictures WHERE galleryid = %d", $id) );

Original comment by v...@alloyphoto.com on 5 Jan 2012 at 5:18

GoogleCodeExporter commented 8 years ago
Forgot to mention - I put a question mark next to version numbers (e.g. @since 
1.9.1?) because I don't know what version you are planning to include these 
changes into.

Other than that, I ran some tests, and the added methods work fine.
Attached is the xmlrpc.file.

Original comment by v...@alloyphoto.com on 5 Jan 2012 at 5:22

Attachments:

GoogleCodeExporter commented 8 years ago
Looks good, will add this during the weekend

Original comment by alex.cologne on 5 Jan 2012 at 6:26

GoogleCodeExporter commented 8 years ago
Perfect, fixed in r1056

Original comment by alex.cologne on 7 Jan 2012 at 2:26