List of users + random/latest picture? List of users + random/latest picture?
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

List of users + random/latest picture?

Started by SNo0py, January 02, 2007, 01:53:09 PM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

SNo0py

Hey there,
is there a way to get a list of users + their latest/random pictures out of Coppermine? Something like just the HTML in the content pane on http://server/index-1.html?
cpmfetch does not work for users that don't have categories, so it's useless. Any other simple ideas?

Thanks!

SNo0py

...cpmfetch does not work because of a bug - the table _categories does not contain anything by default for ordinary users, so the straight join "a.aid = p.aid and a.category = c.cid" does not return anything for private albums of the users. It would only work for public albums.
If LEFT JOIN would be used instead it would work fine.

Joachim Müller

Potential bug reports for cpmFetch should not be posted on the misc support board, but the one that deals with cpmFetch. Moving thread accordingly.

vuud

Quote from: GauGau on January 05, 2007, 09:19:00 AM
Potential bug reports for cpmFetch should not be posted on the misc support board, but the one that deals with cpmFetch. Moving thread accordingly.

Thanks for moving this...
I never would have found it on the other board.



Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

vuud

Quote from: SNo0py on January 02, 2007, 02:30:15 PM
...cpmfetch does not work because of a bug - the table _categories does not contain anything by default for ordinary users, so the straight join "a.aid = p.aid and a.category = c.cid" does not return anything for private albums of the users. It would only work for public albums.
If LEFT JOIN would be used instead it would work fine.

So user level galleries don't have categories assigned to them?  I thought all the user galleries were assigned ID = 1?
Maybe I am not following you...


Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

vuud

Quote from: SNo0py on January 02, 2007, 02:30:15 PM
...cpmfetch does not work because of a bug - the table _categories does not contain anything by default for ordinary users, so the straight join "a.aid = p.aid and a.category = c.cid" does not return anything for private albums of the users. It would only work for public albums.
If LEFT JOIN would be used instead it would work fine.

Never mind my clarification request...  Your right, I was thinking that they were assigned categories since I was coding for over 10000 for id'ing them. 

Problem will be fixed in the 1.9.6 release - hopefully later tonight.
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

vuud

Quote from: vuud on January 07, 2007, 04:07:24 AM
Never mind my clarification request...  Your right, I was thinking that they were assigned categories since I was coding for over 10000 for id'ing them. 

Problem will be fixed in the 1.9.6 release - hopefully later tonight.



As of VERSION 1.9.6 this problem has been resolved.   (6 Jan 2006)

Vuud

http://cpmfetch.fistfullofcode.com/projects/copperminefetch/downloads.php

Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

SNo0py

Quote from: GauGau on January 05, 2007, 09:19:00 AM
Potential bug reports for cpmFetch should not be posted on the misc support board, but the one that deals with cpmFetch. Moving thread accordingly.
Would have loved too, but I'm not allowed to start new threads in the cpmFetch forum!

Quote from: vuud on January 07, 2007, 07:46:48 AM

As of VERSION 1.9.6 this problem has been resolved.   (6 Jan 2006)

Vuud
Wow, thanks, I will check it out right now....

SNo0py

Ok, I checked it now, now it completely stopped working, here is the script:
<?php
  
include './cpmfetch.php';
        
error_reporting(E_ALL);
        
ini_set('display_errors',1);  // 0 is off, 1 is on
  
$objCpm = new cpm();
        print 
$objCpm->cpm_debugMode(true);
  
$objCpm->cpm_viewRandomMediaFrom(1,4'user=mike');
  
$objCpm->cpm_close();
?>


Does not print anything. This is the SQL Query:
SQL : SELECT p.filepath AS pFilepath, p.filename AS pFilename, p.aid AS pAid, p.filesize AS pFilesize, p.title AS pTitle, p.caption AS pCaption, p.owner_name AS pOwner_name, p.owner_id as pOwnerId, p.ctime AS pCtime, p.hits AS pHits, p.pid AS pPid, p.pic_rating AS pPic_Rating, p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, p.user1 as pUser1, p.user2 as pUser2, p.user3 as pUser3, p.user4 as pUser4, c.name as cName, c.description as cDescription, c.pos as cPos, c.parent as cParent, c.thumb as cThumb, u.user_lastvisit AS uUser_lastvisit,u.user_regdate AS uUser_regdate,u.user_email AS uUser_email,u.user_profile1 AS uUser_profile1,u.user_profile2 AS uUser_profile2,u.user_profile3 AS uUser_profile3,u.user_profile4 AS uUser_profile4,u.user_profile5 AS uUser_profile5,u.user_profile6 AS uUser_profile6, a.aid AS aAid, a.title AS aTitle, a.description AS aDescription, a.visibility as aVisibility, a.pos as aPos, a.category as aCategory, a.thumb as aThumb, a.keyword as aKeyword FROM cpg148_pictures as p, cpg148_albums as a LEFT JOIN cpg148_categories as c ON a.category = c.cid, cpg148_users AS u WHERE a.aid = p.aid AND p.owner_id = u.user_id AND p.approved='YES' ORDER BY rand(925325) LIMIT 0 ROWS: 0

The LIMIT 0 seems to be wrong and the check for the user name is missing in the WHERE clause, so it can't work....

vuud

Quote from: SNo0py on January 08, 2007, 07:33:42 AM
Ok, I checked it now, now it completely stopped working, here is the script:
<?php
  
include './cpmfetch.php';
        
error_reporting(E_ALL);
        
ini_set('display_errors',1);  // 0 is off, 1 is on
  
$objCpm = new cpm();
        print 
$objCpm->cpm_debugMode(true);
  
$objCpm->cpm_viewRandomMediaFrom(1,4'user=mike');
  
$objCpm->cpm_close();
?>


Does not print anything. This is the SQL Query:
SQL : SELECT p.filepath AS pFilepath, p.filename AS pFilename, p.aid AS pAid, p.filesize AS pFilesize, p.title AS pTitle, p.caption AS pCaption, p.owner_name AS pOwner_name, p.owner_id as pOwnerId, p.ctime AS pCtime, p.hits AS pHits, p.pid AS pPid, p.pic_rating AS pPic_Rating, p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, p.user1 as pUser1, p.user2 as pUser2, p.user3 as pUser3, p.user4 as pUser4, c.name as cName, c.description as cDescription, c.pos as cPos, c.parent as cParent, c.thumb as cThumb, u.user_lastvisit AS uUser_lastvisit,u.user_regdate AS uUser_regdate,u.user_email AS uUser_email,u.user_profile1 AS uUser_profile1,u.user_profile2 AS uUser_profile2,u.user_profile3 AS uUser_profile3,u.user_profile4 AS uUser_profile4,u.user_profile5 AS uUser_profile5,u.user_profile6 AS uUser_profile6, a.aid AS aAid, a.title AS aTitle, a.description AS aDescription, a.visibility as aVisibility, a.pos as aPos, a.category as aCategory, a.thumb as aThumb, a.keyword as aKeyword FROM cpg148_pictures as p, cpg148_albums as a LEFT JOIN cpg148_categories as c ON a.category = c.cid, cpg148_users AS u WHERE a.aid = p.aid AND p.owner_id = u.user_id AND p.approved='YES' ORDER BY rand(925325) LIMIT 0 ROWS: 0

The LIMIT 0 seems to be wrong and the check for the user name is missing in the WHERE clause, so it can't work....

I think I may have done something sneaky on you:

From the release notes for 1.9.6
Quote
* Changed a number of calls so $source is the first parameter so it linguistically flows.  For any, insert "" instead of a source.
- cpm_viewRandomMediaFrom($source,$rows, $columns, $options="")
- cpm_viewLastAddedMediaFrom($source, $rows, $columns, $options="")
- cpm_getAlbumListFrom ($source, $rows, $columns, $options="")

So you call is passing things in the wrong order.  Try:

$objCpm->cpm_viewRandomMediaFrom('user=mike', 1, 4);

For the 2.0 I plan on putting together a converting to 2.0 cheat sheet...

I think that will fix your problem.  I know its bad form to change a parameter order around in a program, and i would never do it professionally without great reason, but this is FOSS, so haha!

Thanks for the help...
Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

SNo0py

Hey there,
thanks for the help!
Yeah, this is really sneaky... so I have now
<?php
  
include './cpmfetch.php';
        
error_reporting(E_ALL);
        
ini_set('display_errors',1);  // 0 is off, 1 is on
  
$objCpm = new cpm();
        print 
$objCpm->cpm_debugMode(true);
  
$objCpm->cpm_viewRandomMediaFrom('user=mike'1,);
  
$objCpm->cpm_close();
?>

which results in
SQL : SELECT p.filepath AS pFilepath, p.filename AS pFilename, p.aid AS pAid, p.filesize AS pFilesize, p.title AS pTitle, p.caption AS pCaption, p.owner_name AS pOwner_name, p.owner_id as pOwnerId, p.ctime AS pCtime, p.hits AS pHits, p.pid AS pPid, p.pic_rating AS pPic_Rating, p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, p.user1 as pUser1, p.user2 as pUser2, p.user3 as pUser3, p.user4 as pUser4, c.name as cName, c.description as cDescription, c.pos as cPos, c.parent as cParent, c.thumb as cThumb, u.user_lastvisit AS uUser_lastvisit,u.user_regdate AS uUser_regdate,u.user_email AS uUser_email,u.user_profile1 AS uUser_profile1,u.user_profile2 AS uUser_profile2,u.user_profile3 AS uUser_profile3,u.user_profile4 AS uUser_profile4,u.user_profile5 AS uUser_profile5,u.user_profile6 AS uUser_profile6, a.aid AS aAid, a.title AS aTitle, a.description AS aDescription, a.visibility as aVisibility, a.pos as aPos, a.category as aCategory, a.thumb as aThumb, a.keyword as aKeyword FROM cpg148_pictures as p, cpg148_albums as a LEFT JOIN cpg148_categories as c ON a.category = c.cid, cpg148_users AS u WHERE a.aid = p.aid AND p.owner_id = u.user_id AND p.approved='YES' ORDER BY rand(507976) LIMIT 4 ROWS: 4

... at least it displays something, but it does not filter to show only my (or someone elses) images... :(

Any other hint?

vuud

Quote from: SNo0py on January 08, 2007, 02:58:54 PM
Hey there,
thanks for the help!

No, thank you.  You found a problem and submitted it with what was broke...  Your my favorite person of the week! 

Quote

  $objCpm->cpm_viewRandomMediaFrom('user=mike', 1,4 );

... at least it displays something, but it does not filter to show only my (or someone elses) images... :(

Yes, the syntax is owner=, not user=.  That one I did not change on you... :p
Sorry I missed that - I don't use that feature much.




Please post for help to the forum... PM me only if you are sending security related items (passwords, security problems, etc).

cpmFetch - Images, RSS feeds from CPG from outside CPG
New release notification signup also. 
See http://cpmfetch.fistfullofco

SNo0py