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

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 3 Guests are viewing this topic.

stuarta

I've made a simple page using require_once "./cpmfetch/cpmfetch.php";
$objCpm = new cpmfetch("/photos");

include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/coppermine");
$objCpm->cpm_viewRandomMedia(3,3);
$objCpm->cpm_close();
and at first I had the error Unknown column 'u.user_website' in 'field list'.  On following another tip about changing the /* */ around I've lost the error but it's not displaying any images.

Can someone explain what I've done wrong or missed out please

Ok, I've tested the cftest.php and get the following problems.  If I leave the /* */ as they are then I get the following message

"Unknown column 'u.user_website' in 'field list'
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/ftp/simaviatorsuk.org/cpmfetch/cpmfetch_dao.php on line 710"

If I swap them both around to */ /* I get this error

"Parse error: parse error, unexpected '*', expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /home/ftp/simaviatorsuk.org/cpmfetch/cpmfetch_dao.php on line 61"
Comptia A+ / Network + certified

soldstatic

stuarta, you shouldnt have */ /*... /* is a comment so youd basically be commenting out the rest of the code... instead you have comment out ie:

/*
commented stuff here
*/


certain parts of the code and un comment by totally deleting the /* and */ that is around other code.

HOWEVER

I too have the same problem where I switched the comments around, that got rid of the error msg, but now its just not showing any pics at all.

More specifically, as the cftest.php showed, my DOCUMENT_ROOT_PATH or whatever is "bad".
The Doc ROoT path that it displays was something ie:
/home/user/rootdirectory/

When I know that it needs to be:
/home/.otherthing/user/rootdirectory/

so where does DOCUMENT_ROOT_PATH get its value?? What do i need to change on this?

stuarta

ok so how should the /*'s be?

I to had nothing showing when I first changed them round but thought I better make sure that the cdtest was working first before I went any further which is when I came across these problems.
Comptia A+ / Network + certified


stuarta

ok I've put it back to

// This is for CPG versions prior to 1.4
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, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email, u.user_website AS uUser_website, u.user_location AS uUser_location, u.user_interests AS uUser_interest, u.user_occupation AS uUser_occupation';


// This is for CPG v 1.4.1 beta 1
/*
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, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email';
*/


and get the message

Unknown column 'u.user_website' in 'field list'
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/ftp/simaviatorsuk.org/cpmfetch/cpmfetch_dao.php on line 710

I see that I have to comment and uncomment but at risk of being called a n00b, I'm unsure how to do this. :-[
Comptia A+ / Network + certified

soldstatic

// This is for CPG versions prior to 1.4
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, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email, u.user_website AS uUser_website, u.user_location AS uUser_location, u.user_interests AS uUser_interest, u.user_occupation AS uUser_occupation';


// This is for CPG v 1.4.1 beta 1
/*
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, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email';
*/


should be

// This is for CPG versions prior to 1.4
/*
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, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email, u.user_website AS uUser_website, u.user_location AS uUser_location, u.user_interests AS uUser_interest, u.user_occupation AS uUser_occupation';
*/

// This is for CPG v 1.4.1 beta 1

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, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email';

stuarta

right excellent that works thankyou.  Think I have it working now, just have dodgy thumbnails.  Think it is probably because my host is usng GD1.

Temp page I'm working on

http://www.simaviatorsuk.org/home6.php

Comptia A+ / Network + certified

larronni

I have installed CpmFetch and it is working just fine  :)
But now I want to do more.... I like to view the last xxx pictures from an album, and view the title on all the images.
So made a page, and entered : (And some more...)
$options = array("subtitle" => " %t",);
$objCpm1->cpm_viewLastAddedMediaFrom(6,4,32,$options);

But what I can't figure out, is how to get the picture and the title into a tabel.... Like :
|--------------|
|  Picture  |
|              |
| title        |
|--------------|
What I get from this code, is the picture, and the title under the picture.. So if the title is long, the picture moves to the right.....
Is it possbile to do this ??

stuarta

ok think I've just messed it up.

I decided to change my coppermine folder name to gallery.  I've changed the path in CP admin and the fetch test works fine, but my html page is now showing

ERROR: Path to Coppermine incorrect. (/var/www/html/simaviatorsuk.org/coppermine//include/config.inc.php)

It's still looking for the coppermine/include/config.inc.php file but not sure which file is looking for it.
Comptia A+ / Network + certified

soldstatic

did you change the path that the html page is looking for to the new path to cpmfetch and/or coppermine?

stuarta

ok, I feel a prat now lol.  I've just opened up the php file I created and the path hadn't saved, changed it back and it works. Sure I saved it last night, but then it was 1.30am lol

Just got the colours to sort now.
Comptia A+ / Network + certified

soldstatic

so your cpm fetch works fine and you see the pics???

*beep* is wrong with mine...

stuarta

yep works fine thankyou. Just got bad thumbnails which I'm assuming is down to GD1
Comptia A+ / Network + certified

mcm

OK .. I'm pulling my hair out over this .. hope someone can help!

I have coppermine in a subdomain called http://thaiexpat.mcmweb.info .. so I put the following in the index.php of the subdomain.

<?php   
include "cpmfetch/cpmfetch.php";
$objCpm = new cpm('/gallery');
$objCpm->cpm_viewRandomMedia (1,6);
$objCpm->cpm_close();
?>

And I get the error of ...

ERROR: Path to Coppermine incorrect. (/home/content/m/c/m/mcm58/html/gallery//include/config.inc.php)

It thinks the gallery folder is in the main site .. i.e  "http://mcmweb.info/gallery" .. and also .. I don't understand why there are two slashes after "gallery"

So I changed it to ...

<?php   
include "cpmfetch/cpmfetch.php";
$objCpm = new cpm('/thaiexpat/gallery');
$objCpm->cpm_viewRandomMedia (1,6);
$objCpm->cpm_close();
?>

Now it can find the coppermine gallery .. but no thumbnails show and I just get links with incorrect urls. That is.. it sticks in an extra folder called "thaiexpat"

It thinks the url to the gallery is "http://thaiexpat.mcmweb.info/thaiexpat/gallery/"

instead of "http://thaiexpat.mcmweb.info/gallery"

I tried a test page in the root directory (http://mcmweb.info) with ..

<?php   
include "thaiexpat/cpmfetch/cpmfetch.php";
$objCpm = new cpm('/thaiexpat/gallery');
$objCpm->cpm_viewRandomMedia (1,6);
$objCpm->cpm_close();
?>

and that works perfectly.

Anyone know how I can get it to work in the index.php of the subdomain????? HELP!!!

Thanks
;D

stuarta

ok to get round a problem of my host not support GD2, i've temporarily installed coppermine and fetch on a free host.  I'm having difficulty though linking across to it. Is this possible?

My main site is www.simaviatorsuk.org, but I've temporarily installed coppermine to http://stuarttest.awardspace.com/gallery and http://stuarttest.awardspace.com/cpmfetch.

Thanks
Comptia A+ / Network + certified

dsnodgrass

There are many very elegant things that CPMFetch does but actually, I don't need them right now. All I want to do is display a Coppermine album complete, intact, and UNrandomized on a different web page.

Can anyone point me to some code fragment that will do this?  I have looked through the docs and these pages and seem to have missed how to do something rather simple.


doktor k

I just installed cpmfetch and ran the test page and got the following results and error message:

http://www.mypreciouspaws.net/cpmfetch/cpmfetch/cftest.php

5   You set your partial URL to /photos   PASS
10   No dots in partial url   PASS
15   coppermine.php not present   PASS
20   coppermine_dao.php not present   PASS
25   cpmfetch.php found   PASS
30   cpmfetch_dao.php found   PASS
35   Server OS = FreeBSD hostingprod.com 4.10-YAHOO-20040606 FreeBSD 4.10-YAHOO-20040606 #0: i386   INFO
40   WebServer = Apache/1.3.33 (Unix) FrontPage/5.0.2.2510 mod_fastcgi/2.4.2   INFO
45   PHP Version = 4.3.11   INFO
55   DOCUMENT_ROOT: /   INFO
60   C_DOCUMENT_ROOT: Not found   INFO
65   doc_root: Not found (IIS Servers only)   INFO
70   SCRIPT_FILENAME: /cpmfetch/cpmfetch/cftest.php   INFO
75   DOCUMENT_ROOT is a good match   PASS
80   Found CPG config file   PASS

Trying to display some images:

Your installation seems correct so far, you should see a small grid of thumbnails from your gallery
Unknown column 'u.user_website' in 'field list'
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /cpmfetch/cpmfetch/cpmfetch_dao.php on line 710

do I need to do some with MySQL page or do something else

Thanks in advance for your assistance


gmc

Quote from: doktor k on April 01, 2006, 05:51:47 AM
I just installed cpmfetch and ran the test page and got the following results and error message:

http://www.mypreciouspaws.net/cpmfetch/cpmfetch/cftest.php
...

Unknown column 'u.user_website' in 'field list'
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /cpmfetch/cpmfetch/cpmfetch_dao.php on line 710

...

doktor k,
This is a well documented problem in both the provided doc and this thread...  A change is needed in the dao file if running CPG 1.4.
Quote from: mikeyc on March 11, 2006, 01:32:56 AM
...
look at lines 55-65 in the dao file you will find these lines

// This is for CPG versions prior to 1.4
/*
   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, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email, u.user_website AS uUser_website, u.user_location AS uUser_location, u.user_interests AS uUser_interest, u.user_occupation AS uUser_occupation';
*/

// This is for CPG v 1.4.1 beta 1   

   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, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email';


switch these   /* */  to the opposite one and it will fix it.

vuud,
any plans for a more permanent fix for this?  or at least inverting the default so current version cpg users don't run into this?

Greg
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

gmc

I need some help here too please....
(pulling my hair out too mcm...)

Still not able to display images at all in one of my installations, an empty table is produced...
Added "$objCpm->cpm_setDebugMode('true');" to the script, and appears it is finding 0 rows....

Using supplied cftest.php script which is issuing:

$objCpm->cpm_viewRandomMedia(2,3,$styleguide);

and producing output in page source of:

<p><span class='subtitle'>Trying to display some images:</span></p>
<p>Your installation seems correct so far, you should see a small grid of thumbnails from your gallery</p><!-- 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, 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  sk_cpg_pictures as p, sk_cpg_albums as a, sk_cpg_users AS u  WHERE a.aid = p.aid AND p.owner_id = u.user_id AND p.approved='YES'   and a.visibility = 0  ORDER BY rand(836697) LIMIT 6
ROWS: 0
--><table  >
<tr>

</tr>
<tr>

</tr>

</table>

Similar results in other tests as well...

Galley is at http://gallery.gmcdesign/com
Test script is at http://gallery.gmcdesign.com/cpmfetch/cftest.php

Not sure where to look next - can't find any differences between my two installs...  Help is greatly appreciated....

(Edit addition.... One difference I just thought of... the failing site is my OLDEST cpg install... While they are all running 1.4.3 now - the failing site is the only one that used to be 1.2.1...  Could there be something between 1.2.1 and 1.4.3 that didn't get applied properly during the upgrade that CPMFETCH depends on???  Was a direct upgrade from 1.2 to 1.4.3...)

(Still getting incorrectly formed img and link statements on another site... but at least getting output there....)

Thanks,
Greg
Thanks!
Greg
My Coppermine Gallery
Need a web hosting account? See my gallery for an offer for CPG Forum users.
Send me money

MDkai

Just a small hint:


I had the same problem like doktor K
QuoteYour installation seems correct so far, you should see a small grid of thumbnails from your gallery
Unknown column 'u.user_website' in 'field list'
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /cpmfetch/cpmfetch/cpmfetch_dao.php on line 710

After reading gmc's tip i found the /* */ on a different location (between the beta part)
I switched the position but got a parsing error.

After deleting the two /* */ i had no problems at all and the image from my gallery was there ;)
Just my two cents