Advanced search  

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]

Pages: [1] 2   Go Down

Author Topic: Display specific images  (Read 12717 times)

0 Members and 1 Guest are viewing this topic.

Robbi99

  • Coppermine newbie
  • Offline Offline
  • Posts: 5
Display specific images
« 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
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Display specific images
« Reply #1 on: January 16, 2007, 07:35:24 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.

Logged
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

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Display specific images
« Reply #2 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
Quote
Fatal 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.

Code: [Select]
<?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();
?>

Logged

FlyingMongoose

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Display specific images
« Reply #3 on: January 17, 2007, 07:46:13 am »

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?)
Logged

FlyingMongoose

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Display specific images
« Reply #4 on: January 17, 2007, 07:46:58 am »

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

FlyingMongoose

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Display specific images
« Reply #5 on: January 17, 2007, 07:48:33 am »

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

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Display specific images
« Reply #6 on: January 17, 2007, 03:02:52 pm »

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.

Code: [Select]
<?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.


Logged
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

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Display specific images
« Reply #7 on: January 17, 2007, 03:04:23 pm »

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

Oh, thats magical

Logged
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

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Display specific images
« Reply #8 on: January 17, 2007, 03:07:18 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=""])




Logged
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

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Display specific images
« Reply #9 on: January 17, 2007, 05:49:25 pm »

okay changed to
Code: [Select]
<?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...

Quote
Unknown 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
Logged

FlyingMongoose

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Display specific images
« Reply #10 on: January 17, 2007, 06:05:50 pm »

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.
Logged

FlyingMongoose

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Display specific images
« Reply #11 on: January 17, 2007, 06:24:39 pm »

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

Code: [Select]
<?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....
Logged

FlyingMongoose

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Display specific images
« Reply #12 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...
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Display specific images
« Reply #13 on: January 17, 2007, 07:11:32 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.




Logged
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

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Display specific images
« Reply #14 on: January 18, 2007, 01:46:10 am »

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):


   
Quote
cpm_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
Code: [Select]
$cfg['cfBridgedTo'] = 'phpbb2018';(that's default short bridge name in CPG)

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

FlyingMongoose

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Display specific images
« Reply #15 on: January 18, 2007, 01:46:41 am »

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

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Display specific images
« Reply #16 on: January 18, 2007, 03:51:29 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.
Logged
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

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Display specific images
« Reply #17 on: January 18, 2007, 04:03:31 am »

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

FlyingMongoose

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Display specific images
« Reply #18 on: January 19, 2007, 07:42:06 am »

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...)
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: Display specific images
« Reply #19 on: January 19, 2007, 03:40:33 pm »

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



Logged
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
Pages: [1] 2   Go Up
 

Page created in 0.049 seconds with 19 queries.