CpmFetch 1.4 On... Displaying data and images from CPG on your website - Page 39 CpmFetch 1.4 On... Displaying data and images from CPG on your website - Page 39
 

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

CpmFetch 1.4 On... Displaying data and images from CPG on your website

Started by vuud, July 08, 2005, 06:43:10 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jaiak

Hello!!

The mistakes is in the bridged !!

In the same server, other domain, and coppermine without bridged show the thumbnails correcly:

http://www.quadomingueros.com/cpmfetch/cftest.php

What I nedd edit in my coppermine and phpBB bridgeg accoutn in other domain?

Regards from spain

vuud

Quote from: Daworm on April 09, 2006, 10:07:31 AM
Yeah - I am bridged.
Forgot about that.

Are you able to work around that?


Basically what happens is that when you are bridged, coppermine no longer creates users in its own tables.  So when we try to retrieve user info, none are there and no image is returned.

There have been a lot of posts on this, but basically you can create some new users directly in coppermine so that there are some there.  For example, if you have three users in the bridged product, then create three bogus users in coppermine.

If you have many, you may want to find some of the other solutions here.  Some involve changing the code base, which I don't recommend.


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: ribanet on April 09, 2006, 03:05:14 PM
Hello!!

The mistakes is in the bridged !!

In the same server, other domain, and coppermine without bridged show the thumbnails correcly:

http://www.quadomingueros.com/cpmfetch/cftest.php

What I nedd edit in my coppermine and phpBB bridgeg accoutn in other domain?

Regards from spain

See the other posting here
http://forum.coppermine-gallery.net/index.php?topic=19564.msg139796#msg139796
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

jaiak

Hello

Ok. But if I have the coppermine bridgeg... how can I add users?

Is necessary "desbridged", add the users, and after bridgeg again?

This users, are the same users that uploads pictures in the gallery? what users??

Thanks in advance!

jaiak

Hello

I add a "adsfasdf" user in my coppermine, and appear the thumbnails in the test file... is all right??

Thanks for all!

vuud

Quote from: ribanet on April 10, 2006, 12:19:02 AM
Hello

I add a "adsfasdf" user in my coppermine, and appear the thumbnails in the test file... is all right??

Thanks for all!

Yeah, whatever you add in as the bogus users would appear as the owner name if you have that displayed.

Otherwise it seems okay... make sure you have added enough users to cover the number of users in the bridged package

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

kirkage

Quote from: vuud on April 08, 2006, 04:16:21 PM

The error is that IIS does not provide a document root variable so cpmfetch cannot determine what the path to your web directory is.  A few solutions  in the past have been to add in one that tells the system what it would be before the php calls the cpmgfetch object.

So something like:

$_REQUEST['DOCUMENT_ROOT'] = "C://what/ever/the/path/is";

Personally I would switch providers if they ever jumped me to a windows server, but thats just my 15 years of IT experienece talking.


can you help me? which parts i must change and where must i put "$_REQUEST['DOCUMENT_ROOT'] = "C://what/ever/the/path/is";" ??


jaiak

Quote from: vuud on April 10, 2006, 05:00:17 AM
Yeah, whatever you add in as the bogus users would appear as the owner name if you have that displayed.

Otherwise it seems okay... make sure you have added enough users to cover the number of users in the bridged package

Hello again

I add one only "random user", in my phpbb has more thank 400 users registered, but onlu 4 o 5 users upload pictures...

What I need do ?? with one only user added i think that funcionally ok




vuud

Quote from: ribanet on April 10, 2006, 10:26:47 PM
Hello again

I add one only "random user", in my phpbb has more thank 400 users registered, but onlu 4 o 5 users upload pictures...

What I need do ?? with one only user added i think that funcionally ok


I *think* that the user ID assigned to a given picture must have an ID in the coppermine table.  But if you think its working, thats good with me.  Basically it will not display from those that are not in the table.

But the next release should fix this problem
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: kirkage on April 10, 2006, 11:04:57 AM
can you help me? which parts i must change and where must i put "$_REQUEST['DOCUMENT_ROOT'] = "C://what/ever/the/path/is";" ??



You need to have that $_REQUEST thing in before calling the "new" call to cpmfetch.  In the cftest.php file it would be somewhere near the top - aside from that you need to change the "C://what/ever/the/path/is"; to the path to your directory.  I have no idea what that is so i can't help you.  I really don't support windows web servers for this software, but it can be done.

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

Daworm

Oh cool - so if I add 10 random users to the coppermine it'll display images from the first 10 people on the forums?

I think I could live with that.

The users keeps growing on the forums though - it's about 60 people atm so... yeah.

-------
I think I'll wait till an update comes :-)

vuud

Quote from: Daworm on April 11, 2006, 02:32:24 PM
Oh cool - so if I add 10 random users to the coppermine it'll display images from the first 10 people on the forums?

I think I could live with that.

The users keeps growing on the forums though - it's about 60 people atm so... yeah.

-------
I think I'll wait till an update comes :-)


I will try to hurry
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: Maestro1 on April 07, 2006, 10:00:49 PM
Running Apache web server v1.3... It is shared hosting. CPMFetch is not showing anything in test file. Database is mySQL v4, on other server and domain...
Need more info?

Got your cftest url... strange but it should work.

Do you have coppermine bridge with anything?

That could cause your problem - but the bad document root is okay from what I can tell...  strange, but it finds the config file later which is what that is really used for.

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

Vanceone

Interesting topic.  :D   I admire your patience, vuud, and thanks for the software.  I'm running IPB 2.1.4, Coppermine 1.4.3, and CPMfetch 1.6.2.   I initially had problems with only getting a few pictures pulled from several of my categories, but after reading this topic, it was most likely the bridge to IPB.  And indeed, it was.  The relevant table name is ibf_members; the field is "id".  So, I just renamed your query appropriately, like in the phpbb examples previously given.  Works great.  Find and replaced all ten instances.    I get my latest pictures now. 

The problem is I get three copies of them, usually.  Someone else had this same problem a couple of months ago, but as I recall it was never addressed. 

More info, as you request:  :D   Running apace 1.3.3, PHP 4.4.1.  Links:  My gallery is www.harmonyforever.com/cpg143/.   Example page displaying problem is this:  www.harmonyforever.com/recent_fanart.php.  While this is meant to be a plugin to my CMS (Subdreamer), this is not inside subdreamer yet.  (interestingly enough, though, it works fine there--as in it displays all of these same images; but just multiple copies of them).  Running this code:

<?

error_reporting(E_ALL);
ini_set('display_errors',1);  // 0 is off, 1 is on

require_once "./cpmfetch/cpmfetch.php";
$pict = new cpm("/cpg143");
$pict->cpm_unlock_private(false);
$pict->cpm_setDebugMode(true);
$last_source = "cat=2,3,11,8,9,10";
$pict->cpm_viewRandomTopRatedMediaFrom("cat=3", 4, 3, 12);

$pict->cpm_close();
?>


This is the code generating the above "recent_fanart.php" page.  As you can see, no errors are being generated.

As for my technical ability; i'd say fairly advanced.  I'm comfortable with myql, and php.  I just can't see why it's pulling duplicate copies of the images once I find and replace the u.user_id sql query with the ibf one.  This is what I changed line 94, I believe it is, of the dao file to: 

    $this->sqlPictureSourceSelect = " " . $database_table_prefix . "pictures as p, " . $database_table_prefix . "albums as a, "
. $database_table_prefix . "users AS u, ibf_members AS ibf ";


I use ibf.id where the u.user_id was before. 

I hope this is the info you need!

ETA:  Here is my cpmtest file, too.  www.harmonyforever.com/cpmfetch/cftest.php    It's interesting to note that while it pulls pictures, it does not pull the views of those pictures.  It's not pulling duplicate versions, either.

Since I have over a 1000 possible members to upload pictures, I have to integrate this with my IPB database; the trick of just slapping a few members into coppermine isn't feasible. 

vuud

Quote from: Vanceone on April 11, 2006, 05:26:43 PM
Interesting topic.  :D   I admire your patience, vuud, and thanks for the software.  I'm running IPB 2.1.4, Coppermine 1.4.3, and CPMfetch 1.6.2.   I initially had problems with only getting a few pictures pulled from several of my categories, but after reading this topic, it was most likely the bridge to IPB.  And indeed, it was.  The relevant table name is ibf_members; the field is "id".  So, I just renamed your query appropriately, like in the phpbb examples previously given.  Works great.  Find and replaced all ten instances.    I get my latest pictures now. 

Please send me a general list of what you changed.  The next release will have these autoselected but I have no intention of installing every one, so only bridged information i receive will be included.

Quote
The problem is I get three copies of them, usually.  Someone else had this same problem a couple of months ago, but as I recall it was never addressed. 

More info, as you request:  :D   Running apace 1.3.3, PHP 4.4.1.  Links:  My gallery is www.harmonyforever.com/cpg143/.   Example page displaying problem is this:  www.harmonyforever.com/recent_fanart.php.  While this is meant to be a plugin to my CMS (Subdreamer), this is not inside subdreamer yet.  (interestingly enough, though, it works fine there--as in it displays all of these same images; but just multiple copies of them).  Running this code:

<?

error_reporting(E_ALL);
ini_set('display_errors',1);  // 0 is off, 1 is on

require_once "./cpmfetch/cpmfetch.php";
$pict = new cpm("/cpg143");
$pict->cpm_unlock_private(false);
$pict->cpm_setDebugMode(true);
$last_source = "cat=2,3,11,8,9,10";
$pict->cpm_viewRandomTopRatedMediaFrom("cat=3", 4, 3, 12);

$pict->cpm_close();
?>


This is the code generating the above "recent_fanart.php" page.  As you can see, no errors are being generated.



Hmmm, a few things... the TopRated stuff is a bit iffy.  Also, you have that extra "12" in your function call, which I don't think does anything as that is where the options array should be.  Who know what an integer there would do...

Anyway the whole top rated/viewed thing is a bit out of whack.  Your seeing repeats because the default behavior is to grab the top 10% of the images.  In your case that would be "4".  Hence the repeating since you ask for 12.

Look for these at the top of the cpmfetch_dao file... they represent the percentages.

In your case, I'd change the $topPercentForTopRated to at least 30 (30 percent would be the top 12).  You can go higher than that if you want.

var $topPercentForTopRated = 10;
var $topPercentForMostViewed = 25;

Those functions are a bit funky and need work anyway - I've just not come up with a good way to do it.


Thanks for the complete problem report.  It helps

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

Vanceone

Thanks for the fast reply.  I included that 12 in my function call, as the documentation doesn't say it takes an array, where every other function DOES take the array.  Good to know that was an error. 

As for what I changed.  All is in the dao file. 
Here is line 95-96: $this->sqlPictureSourceSelect = " " . $database_table_prefix . "pictures as p, " . $database_table_prefix . "albums as a, "
. $database_table_prefix . "users AS u, ibf_members AS ibf ";

line 277:users AS u WHERE p.aid = a.aid and p.pid = $pid AND p.owner_id = ibf.id
Line 295: where p.aid = a.aid AND p.owner_id = ibf.id
line 320: " where p.aid = a.aid AND p.owner_id = ibf.id "
line 355: " where p.aid = a.aid AND p.owner_id = ibf.id "
line 398: where p.aid = a.aid AND p.owner_id = ibf.id
line 430: where p.aid = a.aid AND p.owner_id = ibf.id
line 457: WHERE a.aid = p.aid AND p.owner_id = ibf.id AND p.approved='YES'
line 478: WHERE m.pid = p.pid AND p.aid = a.aid AND p.owner_id = ibf.id"
line 496: " WHERE p.aid = a.aid  AND p.owner_id = ibf.id and p.approved='YES' $this->privacyfilter and p.ctime > "
line 514: " WHERE p.aid = a.aid  AND p.owner_id = ibf.id AND p.approved='YES' $this->privacyfilter and p.ctime > "

As for that function, I really want a most recent viewed one.  This is when the problem is really on display.  This is my new recent_fanart.php page now:
<?

error_reporting(E_ALL);
ini_set('display_errors',1);  // 0 is off, 1 is on

require_once "./cpmfetch/cpmfetch.php";
$pict = new cpm("/cpg143");
$pict->cpm_unlock_private(false);
$pict->cpm_setDebugMode(true);
$last_source = "cat=2,3,11,8,9,10";
$pict->cpm_viewLastAddedMediaFrom( 4, 6, "cat=3");

$pict->cpm_close();
?>

If you reload www.harmonyforever.com/recent_fanart.php   you can see the problem in full display.  As you can tell, there's something screwy going on.  It's loading each image three times.  I'm not using an options array, of course. 

For your further information, here is the list of table names for an IPB 2.1.4 installation.  The relevant one is members, not the other 3 members tables.  The Id field is in members. 
ibf_admin_logs
    ibf_admin_permission_keys
    ibf_admin_permission_
    ibf_admin_sessions
    ibf_announcements
    ibf_attachments
    ibf_attachments_type
    ibf_badwords
    ibf_banfilters
    ibf_bulk_mail
    ibf_cache_store
    ibf_cal_calendars
    ibf_cal_events
    ibf_calendar_events
    ibf_components
    ibf_conf_settings
    ibf_conf_settings_titles
    ibf_contacts
    ibf_custom_bbcode
    ibf_dnames_change
    ibf_email_logs
    ibf_emoticons
    ibf_faq
    ibf_forum_perms
    ibf_forum_tracker
    ibf_forums
    ibf_groups
    ibf_languages
    ibf_login_methods
    ibf_mail_error_logs
    ibf_mail_queue
    ibf_member_extra
    ibf_members
    ibf_members_converge
    ibf_members_partial
    ibf_message_text
    ibf_message_topics
    ibf_moderator_logs
    ibf_moderators
    ibf_pfields_content
    ibf_pfields_data
    ibf_polls
    ibf_posts
    ibf_reg_antispam
    ibf_rss_export
    ibf_rss_import
    ibf_rss_imported
    ibf_search_results
    ibf_sessions
    ibf_skin_macro
    ibf_skin_sets
    ibf_skin_templates
    ibf_skin_templates_cache
    ibf_spider_logs
    ibf_stats
    ibf_subscription_currency
    ibf_subscription_extra
    ibf_subscription_logs
    ibf_subscription_methods
    ibf_subscription_trans
    ibf_subscriptions
    ibf_task_logs
    ibf_task_manager
    ibf_template_diff_changes
    ibf_template_diff_session
    ibf_templates_diff_import
    ibf_titles
    ibf_topic_markers
    ibf_topic_mmod
    ibf_topic_ratings
    ibf_topic_views
    ibf_topics
    ibf_topics_read
    ibf_tracker
    ibf_upgrade_history
    ibf_validating
    ibf_voters
    ibf_warn_logs

vuud

Quote from: Vanceone on April 11, 2006, 07:28:31 PM
Thanks for the fast reply.  I included that 12 in my function call, as the documentation doesn't say it takes an array, where every other function DOES take the array.  Good to know that was an error. 

As for what I changed.  All is in the dao file. 

SNIP

As for that function, I really want a most recent viewed one.  This is when the problem is really on display.  This is my new recent_fanart.php page now:
<?

error_reporting(E_ALL);
ini_set('display_errors',1);  // 0 is off, 1 is on

require_once "./cpmfetch/cpmfetch.php";
$pict = new cpm("/cpg143");
$pict->cpm_unlock_private(false);
$pict->cpm_setDebugMode(true);
$last_source = "cat=2,3,11,8,9,10";
$pict->cpm_viewLastAddedMediaFrom( 4, 6, "cat=3");

$pict->cpm_close();
?>

If you reload www.harmonyforever.com/recent_fanart.php   you can see the problem in full display.  As you can tell, there's something screwy going on.  It's loading each image three times.  I'm not using an options array, of course. 


Dang thats alot.  I guess I really only need the members layout from IBF... 

I am not sure what is causing that...  The SQL seems okay...

I'm not even sure what to suggest next... 

The other problem a few months ago... were they IBF also?  Almost seems like its a bad SQL join, but the generated SQL looks good (the debug adds in an HTML comment with the SQL code)


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

Daworm

Quote from: vuud on April 11, 2006, 04:17:36 PM

I will try to hurry

A work of art takes time :-)

Don't hurry too much or you'll leave a

;
or
()
out without thinking :-)

Vanceone

Okay, I fixed it.  Took a while, but I slogged through and fixed it.  Here's the problem, basically.  When I created my coppermine install, I added two extra users into it, for a total of three.  When I changed the query to pull from IBP, it somehow pulled one for EACH of my three users in coppermine.  Rather  than delete my backup administrator for coppermine, I went ahead and fully integrated CPMFetch with Invision PowerBoard.  Since I imagine you'd like to know how... I'll attach my copy of the dao file for you. 

Here is the problem.  This is my select  that was causing the error: 
QuoteSELECT  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, a.title AS aTitle, a.description AS aDescription, p.pid AS pPid, p.pic_rating AS pPic_Rating,  p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email FROM  cpg143_pictures as p, cpg143_albums as a, cpg143_users AS u, ibf_members AS ibf  where p.aid = a.aid AND p.owner_id = ibf.id and p.approved='YES'  and  ( a.category=3 )   and a.visibility = 0   ORDER BY p.ctime DESC LIMIT 0,24

The part in bold is the issue. Since I had 3 existing users in the coppermine database, independant of my IPB database (and not accessible from Coppermine anymore to delete without using PHPmyadmin, thus destroying any hope of an easy fix for casual users), it pulled back a thumbnail for each user.  If I had had four users in coppermine, or 5, 6, etc, I would have gotten one for each of them.  So,  what to do?  I erased the offending code, since it is not needed anywhere else, and fixed all names to point to the ibf fields instead (primarily in the hack to get cpmFetch to work with coppermine 1.4.   

Line 62 of the Dao file now reads like so, with the proper Ipb fields from the ibf_member table inserted:
Quote
   var $sqlPictureAlbumSelect = ' 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, a.title AS aTitle, a.description AS aDescription, p.pid AS pPid, p.pic_rating AS pPic_Rating,  p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, ibf.last_visit AS uUser_lastvisit, ibf.joined AS uUser_regdate, ibf.email AS uUser_email';

Here is lines 95-96 now:
Quote$this->sqlPictureSourceSelect = " " . $database_table_prefix . "pictures as p, " . $database_table_prefix . "albums as a, "
            . " ibf_members AS ibf ";

As you can see, the $database_table_prefix variable is messed up from the original; i had to delete it and the entire "AS u" statement.  Those two changes, along with the changes in my previous post, now cause cpm_fetch to work with Invisionpowerboard 2.1.4 integration. 

This, of course, assumes that your cpg install is in the same database as your IPB install.  Also, this assumes that the ibf_members table really is named that; if your prefix for IPB is not ibf, then adjust appropriately.  I also did not fix it for versions of coppermine prior to 1.4, so some changes would be need to be made for that. 

vuut, here is the field names for the ibf_members table, in sql format (with backticks):
Quote
`id`, `name`, `mgroup`, `legacy_password`, `email`, `joined`, `ip_address`, `posts`, `title`, `allow_admin_mails`, `time_offset`, `hide_email`, `email_pm`, `email_full`, `skin`, `warn_level`, `warn_lastwarn`, `language`, `last_post`, `restrict_post`, `view_sigs`, `view_img`, `view_avs`, `view_pop`, `bday_day`, `bday_month`, `bday_year`, `new_msg`, `msg_total`, `show_popup`, `misc`, `last_visit`, `last_activity`, `dst_in_use`, `view_prefs`, `coppa_user`, `mod_posts`, `auto_track`, `org_perm_id`, `temp_ban`, `sub_end`, `login_anonymous`, `ignored_users`, `mgroup_others`, `member_login_key`, `has_blog`, `subs_pkg_chosen`, `members_auto_dst`, `members_cache`, `members_disable_pm`, `members_display_name`, `members_created_remote`, `members_editor_choice`, `members_markers`

n3n

Hi Vuud,

I have a question. I would like to embed  cpmfetch in my theme.php, next to the intermediate image, to show the last uploads by that user. Could you point me in the right direction, cause i cant seem to get it working.

Tnx alot for all the nice features in CPMfetch.