Display specific images Display specific images
 

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

Display specific images

Started by Robbi99, January 16, 2007, 07:15:42 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

Robbi99

Hi,

I am a real newbie and intend to use cpmFetch to display specific images from Coppermine on a remote Website (MediaWiki). Am I right, that cpmFetch can only display random genrate pictures or the latest images from the coppermine gallery?
Is there a possibility for one every time the same specific image?

Thanks,

Robbi

vuud

Quote from: Robbi99 on January 16, 2007, 07:15:42 PM
Hi,

I am a real newbie and intend to use cpmFetch to display specific images from Coppermine on a remote Website (MediaWiki). Am I right, that cpmFetch can only display random genrate pictures or the latest images from the coppermine gallery?
Is there a possibility for one every time the same specific image?

Thanks,

Robbi

I believe there is a way to request a photo by pid (photo id).   I will have to check later - but I am pretty sure I added that in.

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

FlyingMongoose

There's a function

cpm_viewMediaByPid($pid, [array $options=""])

However, any time I try to use it myself it results in the following error
QuoteFatal error: Call to a member function on a non-object in /cpmfetch.php on line 183

(Didn't include full server path on that quote...but you can probably understand why).

I'm pretty sure I'm doing way wrong. But here's the example of the code I'm using.

<?php
require_once('./cpmfetch/cpmfetch.php');
$objCpm = "";
$objCpm = new cpm($PartialUrlToCPG);
$options = array(
"imagelink" => "large",
"windowtarget" => "_blank");
$pid = 1;
$objCpm->cpm_viewMediaByPid($pid,$options);
$objCpm->cpm_close();
?>



FlyingMongoose

oh yeah, I manually set the PID to see if it would work right that way, which I still ended up with the error.
(Why can't I edit my post?)

FlyingMongoose

Oh yeah, running in 1.6.4 (no dev environment running right now for me)

FlyingMongoose

Just messed with something (not sure what) now it says error on line 790 (same file)

vuud

Quote from: FlyingMongoose on January 17, 2007, 07:44:10 AM
There's a function

cpm_viewMediaByPid($pid, [array $options=""])

However, any time I try to use it myself it results in the following error
(Didn't include full server path on that quote...but you can probably understand why).

I'm pretty sure I'm doing way wrong. But here's the example of the code I'm using.

<?php
require_once('./cpmfetch/cpmfetch.php');
$objCpm = "";
$objCpm = new cpm($PartialUrlToCPG);
$options = array(
"imagelink" => "large",
"windowtarget" => "_blank");
$pid = 1;
$objCpm->cpm_viewMediaByPid($pid,$options);
$objCpm->cpm_close();
?>




Did you set $PartialUrlToCPG to anything or are you just passing an empty variable?  The error you are getting generally means you are not getting the cpmfetch object constructed correctly.


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: FlyingMongoose on January 17, 2007, 07:48:33 AM
Just messed with something (not sure what) now it says error on line 790 (same file)

Oh, thats magical

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: Robbi99 on January 16, 2007, 07:15:42 PM
Hi,

I am a real newbie and intend to use cpmFetch to display specific images from Coppermine on a remote Website (MediaWiki). Am I right, that cpmFetch can only display random genrate pictures or the latest images from the coppermine gallery?
Is there a possibility for one every time the same specific image?

Thanks,

Robbi

Yeah, thats the function

$objCpm->cpm_viewMediaByPid($pid, [array $options=""])




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

FlyingMongoose

okay changed to
<?php
require_once('./cpmfetch/cpmfetch.php');
$objCpm = "";
$PartialUrlToCPG = "/gallery";
$objCpm = new cpm($PartialUrlToCPG);
$options = array(
"imagelink" => "large",
"windowtarget" => "_blank");
$image = 1;
$objCpm->cpm_viewMediaByPid($image,$options);
$objCpm->cpm_close();
?>


and now the following problem occurs...

QuoteUnknown column 'u.user_id' in 'where clause'
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /cpmfetch_dao.php on line 707

I'm on PHP 4.4.2

FlyingMongoose

After much much searching I think I know what I need to do (I'm bridged with PHPBB), so I'm gonna have to go through and make some of the code reflect  the PHPBB tables.

FlyingMongoose

Alright so I got rid of the errors.

I've attached my modification to cpmfetch_dao.php (as a .txt file since .php is not allowed to be attached just rename it to .php) it should would with phpbb 2.0.22 (the version I'm using) bridged...


But I'm not getting any kind of output with the code, none whatsoever

<?php
require_once('./cpmfetch/cpmfetch.php');
$objCpm = "";
$PartialUrlToCPG = "/gallery";
$objCpm = new cpm($PartialUrlToCPG);
$options = array(
"imagelink" => "large",
"windowtarget" => "_blank");
$image = 1;
$objCpm->cpm_viewMediaByPid($image,$options);
$objCpm->cpm_close();
?>


am I doing something wrong?

Suggestion for your installer on the dev version:
Include a few different cpmfetch_dao.php files dependant on bridging, in readme/install files have user rename said included cpm_fetch_dao.php if they are bridged.

example
Default: cpm_fetch_dao.php
phpbb: cpm_fetch_dao_phpbb.php
smf: cpm_fetch_dao_smf.php

It may be an extra step, but it's less of these problems you really have to work with in the end....

FlyingMongoose

nevermind on that last suggestion...I'm looking through your code on the new dev and I see you have a generic solution...

vuud

Quote from: FlyingMongoose on January 17, 2007, 06:32:35 PM
nevermind on that last suggestion...I'm looking through your code on the new dev and I see you have a generic solution...

Yes,  in fact the last thing really holding up the dev becoming stable is:

1) I want it to autodetect a bridged configuration

2) At least one bridge fully enabled (probably smf since I use that, maybe phpbb also)

3) All other bridges get the default till I work them in.

That way no alternate files, no end user configuration changes, etc...


The dev version should allow you to set the bridged line in the cpmfetch_config.php to "phpbb" which should run the generic code and work for 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

FlyingMongoose

Well, you have my dao file, with that you can probably get the information you need for PHPBB support (2.0.x anyway)

Also, I'm going to try to make current dev version work with it, so far i'm at least getting output from the function earlier discussed, currently I'm getting the following error (I have debug turned on so that I can get more info out of it):


   
Quotecpm_dao. Setting cfFilesystemPathToAlbums to //albums/

    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, 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 cpg_pictures AS p, cpg_albums AS a LEFT JOIN cpg_categories AS c ON a.category = c.cid, cpg_users AS u WHERE p.aid = a.aid AND p.pid = 1 AND p.approved='YES' ROWS: 2

Error in getImageTouse: Extension (strtolower): .jpg File://albums/userpics/10003/thumb_k-soccer.jpg
Error in getImageTouse: Extension (strtolower): .jpg File://albums/userpics/10003/thumb_k-soccer.jpg

    DEPRECIATED: Avoid using % style option array calls. Pls use {{ }} style

Error in getImageTouse: Extension (strtolower): .jpg File://albums/userpics/10003/thumb_k-soccer.jpg


I have $cfg['cfBridgedTo'] = 'phpbb2018';(that's default short bridge name in CPG)

and I have $cfg['cfDebugMode'] = 'true';(for the obvious)

FlyingMongoose

I'm getting output, but no actual image is what I mean.

vuud

Quote from: FlyingMongoose on January 18, 2007, 01:46:41 AM
I'm getting output, but no actual image is what I mean.

Can you PM me the output from your install page?

The lower part is what I am interested in.

Strange that you are getting a double slash in the dev version... I thought I had that all ironed out.

Oh well.
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

FlyingMongoose

I found that double slash, but that isn't where the problem is (there's a . "\" .) in _dao.php

FlyingMongoose

if there's anywhere you'd like me to help I will, but I'm not exactly the greatest of coders (this is a brick wall to me...)

vuud

Quote from: FlyingMongoose on January 18, 2007, 01:46:41 AM
I'm getting output, but no actual image is what I mean.

Okay, its not finding the albums cause its looking in the wrong place.

One note:  You will never see photos in THIS version of the install.php, because you are bridged.  Everytime you rerun install it will wipe out your config file that you made the change too.    So best to run it, change the bridged setting and move on.

Please post the code from the other page you are calling it from...



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