basic cpmfetch code basic cpmfetch code
 

News:

CPG Release 1.6.26
Correct PHP8.2 issues with user and language managers.
Additional fixes for PHP 8.2
Correct PHP8 error with SMF 2.0 bridge.
Correct IPTC supplimental category parsing.
Download and info HERE

Main Menu

basic cpmfetch code

Started by bcddd214, February 04, 2007, 06:56:41 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

bcddd214

trying to find the code for using cpmfetch to pull one, possible 2 pictures.
No arrays
no html
nothing fancy

I want to open cpmfetch at the begining of the php file and then slap in an occasional picture in the file.

then close cpmfetch.

I have no categories in my coppermine, only albums and a pos number.
i.e.
http://www.boatcrafts.net/copper/displayimage.php?album=1&pos=182

bcddd214

PS,

I did read
http://www.fistfullofcode.com/projects/copperminefetch/manual/index.html
and
http://www.cponygo.com/copperminefetch-1.6.2/docs/

They do not help at all when you are working with 1 simgle picture.
plugging the img src>  tag just gives you an error.
What else goes with it to make it work?
What if the only information you have to work with is the html page of the photo?
http://www.boatcrafts.net/copper/displayimage.php?album=1&pos=182

So, I have a album number and a pos number.

If people are going to start working with this technology, there NEEDS TO BE A LOT MORE DOCUMENTATION ON THE BASICS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Brad

vuud

Quote from: bcddd214 on February 04, 2007, 08:08:03 PM
PS,

I did read
http://www.fistfullofcode.com/projects/copperminefetch/manual/index.html
and
http://www.cponygo.com/copperminefetch-1.6.2/docs/

They do not help at all when you are working with 1 simgle picture.
plugging the img src>  tag just gives you an error.
What else goes with it to make it work?
What if the only information you have to work with is the html page of the photo?
http://www.boatcrafts.net/copper/displayimage.php?album=1&pos=182

So, I have a album number and a pos number.

If people are going to start working with this technology, there NEEDS TO BE A LOT MORE DOCUMENTATION ON THE BASICS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Brad


Hi Brad,

Thanks for the thoughts and stuff on this. 

To get a single photo you would just request 1 column and 1 row.

Pretty much what was on the quickstart I think... You just put the call to get the photo where you want it in your page.  Put the open at the top, and the close at the bottom and whatever in between.

http://www.fistfullofcode.com/projects/copperminefetch/quickstart.php

Quote
If people are going to start working with this technology, there NEEDS TO BE A LOT MORE DOCUMENTATION ON THE BASICS!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

I think you mean beginners.  And I would love nothing more that to have that level of help and documentation.  I am such a firm believer that I have ordered my staff to spend approximately 75% of our profit from sales of CpmFetch into developing this level of documentation.   I have also repeatedly offered to included user generated documenation and submissions to help people along - but they have really let you down in this area.  I can understand how angry you must be with them!   I have long argued with them that CpmFetch should be there to teach people how to use CSS, and how to use PHP! 

I personally, can barely contain myself with rage.

We have recently brought in an outside think tank to analyze our position and determine where our company focus should be.  After scrutizing our sales income, userbase and cost for providing support - they have determined that the best way for CpmFetch to stop losing as much money is to actually have less users!  That's right!  The less people that use it, the less time spent on supporting it and the less time spent on bug fixes and feature requests.  I am told however, that in our current model we shall, alas, never be profitable.

So you see, that if we did make it so everyone would use it, we would be even less profitable.  My hands are financially tied.

Regards,

Vuud








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

bcddd214

How do you cpmfetch by picture id?
Not by category,
It is not mentioned in any way shape or for in the quick start.
I do not want to pictures to randomly change
I do not want to pull up multiple galleries

I need to pull up one picture and one picture only, and it should be the same picture every time.

vuud

Quote from: bcddd214 on February 04, 2007, 09:56:07 PM
How do you cpmfetch by picture id?
Not by category,
It is not mentioned in any way shape or for in the quick start.
I do not want to pictures to randomly change
I do not want to pull up multiple galleries

I need to pull up one picture and one picture only, and it should be the same picture every time.

If I put every feature in the quickstart, it would not be the quickstart anymore it would be the documentation...

That feature especially is rarely used AFAIK...
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

bcddd214

where?

I see a img src reference, but that is for an entire category.
I have 100 pictures in that category.

That not going to do any good with a batch upload....

vuud

Quote from: bcddd214 on February 04, 2007, 10:09:55 PM
where?

I see a img src reference, but that is for an entire category.
I have 100 pictures in that category.

That not going to do any good with a batch upload....

Where is it in the documentation?

http://www.fistfullofcode.com/projects/copperminefetch/manual/ch07s03.html
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

bcddd214

can you possibly put it in example format?

bcddd214

my error

Unknown table 'u' in where clause
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/brads/public_html/cpmfetch/cpmfetch_dao.php on line 707


the code I got from the only example I could find

<?php   
   require_once('../cpmfetch/cpmfetch.php');
   $objCpm = new cpm('/copper');
   $image = 459;
   $objCpm->cpm_viewMediaByPid($image,$options);
   $objCpm->cpm_close();
?>

vuud

Quote from: bcddd214 on February 04, 2007, 10:39:34 PM
my error

Unknown table 'u' in where clause
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/brads/public_html/cpmfetch/cpmfetch_dao.php on line 707


the code I got from the only example I could find

<?php   
   require_once('../cpmfetch/cpmfetch.php');
   $objCpm = new cpm('/copper');
   $image = 459;
   $objCpm->cpm_viewMediaByPid($image,$options);
   $objCpm->cpm_close();
?>

Do you have a forum bridged with coppermine?

If so, that is the problem.  The 1.6.x later releases ended up with a problem of sites that are bridged. 

Let me know if you are bridged, and I will outline the solutions 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

bcddd214

no, it is an indepentdent php page

I have not attempted this with the forums section of my website

baby steps!

new cleaner code

<?php   
   require_once('../cpmfetch/cpmfetch.php');
   $objCpm = new cpm('/copper');
   $pid = 459;
   $objCpm->cpm_viewMediaByPid($pid);
   $objCpm->cpm_close();
?>

my error

Unknown table 'u' in where clause
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/brads/public_html/cpmfetch/cpmfetch_dao.php on line 707

bcddd214

coppermine is the latest stable

cpmfetch is the latest stable.

Just installed both of them last night....

bcddd214

this code works perfect, but does not do the job needed because the pictures change.

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

this code does not

<?php   
   require_once('../cpmfetch/cpmfetch.php');
   $objCpm = new cpm('/copper');
   $pid = 459;
   $objCpm->cpm_viewMediaByPid($pid);
   $objCpm->cpm_close();
?>

vuud

Quote from: bcddd214 on February 04, 2007, 10:51:01 PM
coppermine is the latest stable

cpmfetch is the latest stable.

Just installed both of them last night....

Okay, good.  That stuff helps.  For the forum thing, I mean when you installed Coppermine Photo Gallery, did you enable it to be bridged with your forum?

The unknown table error is familar...  What version of CPG exactly are you using, and what version exactly of cpmfetch?

The error is very reminicent of an older pre 1.4.x version of CPG with cpmfetch...  The user table did not exist until 1.4 I believe.




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: bcddd214 on February 04, 2007, 10:57:28 PM
this code works perfect, but does not do the job needed because the pictures change.

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

this code does not

<?php   
   require_once('../cpmfetch/cpmfetch.php');
   $objCpm = new cpm('/copper');
   $pid = 459;
   $objCpm->cpm_viewMediaByPid($pid);
   $objCpm->cpm_close();
?>

So only the second code block there gives you an error?  The unknown table error?


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

bcddd214


copperminefetch-1.6.4.tar.gz

and

cpg1.4.10.zip 

I am not using this in phpbb as of yet. I would like to later.

This is on a flat php file only right now.

I did not do anything concerning bridging during the install. I just followed the directions.....

phill104

Am I being a bit thick here? I cannot see the point of what you are trying to do.

Let me just get this straight, you want to put a single picture that will never change onto a page. Why do you not just copy the image to the page in question?
It is a mistake to think you can solve any major problems just with potatoes.

vuud

Quote from: phill104 on February 04, 2007, 11:49:27 PM
Am I being a bit thick here? I cannot see the point of what you are trying to do.

Let me just get this straight, you want to put a single picture that will never change onto a page. Why do you not just copy the image to the page in question?

Hi Phil,

I bit my tongue on that one for awhile, but then started thinking that sure it would be strange to do it for one specific photo, but if you wanted to show total views or comments or something under it, cpmfetch is your man (or program).

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: bcddd214 on February 04, 2007, 11:15:04 PM
copperminefetch-1.6.4.tar.gz

and

cpg1.4.10.zip 

I am not using this in phpbb as of yet. I would like to later.

This is on a flat php file only right now.

I did not do anything concerning bridging during the install. I just followed the directions.....

Okay, apparently there is a bug in that function in cpmfetch 1.6.4.  Not a much used (or apparently tested) function.


You have two options:

#1) Upgrade to the lastest dev release (which is fraught by a lack of completed documentation)

#2) Edit your cpmfetch_dao.php file.

Find line 273 which looks like this:
$sqlcode = "SELECT " . $this->sqlPictureAlbumSelect . " FROM " . $this->cpm_table_prefix

And add this:

. $this->cpm_table_prefix . "users AS u,  "

so it looks like so:

$sqlcode = "SELECT " . $this->sqlPictureAlbumSelect . " FROM " . $this->cpm_table_prefix . "users AS u,  " . $this->cpm_table_prefix

Save it.  If you get a SQL error, make sure it is exactly as I showed.


If you do the upgrade to the dev version, BE SURE TO READ THE INSTALL INSTRUCTIONS IN THE README THAT COMES WITH IT







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

bcddd214

Thank you Phil and Vuud.

First off, why I just do not put a picture on the pic.

Doesn't make sense if I already have a copy on the picture on a high performance database and coppermine. Why do it twice?
Easy of implementation into other webpages by just slapping in the call code putting resource demand on the end user instead of the server twice.

Security reason.

Plus a few more reasons.

I will try the code you offered.

Thanks guys!!!!