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 3   Go Down

Author Topic: basic cpmfetch code  (Read 25938 times)

0 Members and 1 Guest are viewing this topic.

bcddd214

  • Coppermine newbie
  • Offline Offline
  • Posts: 19
basic cpmfetch code
« on: February 04, 2007, 06:56:41 pm »

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
Logged

bcddd214

  • Coppermine newbie
  • Offline Offline
  • Posts: 19
Re: basic cpmfetch code
« Reply #1 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
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: basic cpmfetch code
« Reply #2 on: February 04, 2007, 09:51:31 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








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

bcddd214

  • Coppermine newbie
  • Offline Offline
  • Posts: 19
Re: basic cpmfetch code
« Reply #3 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.
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: basic cpmfetch code
« Reply #4 on: February 04, 2007, 10:04:20 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...
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

bcddd214

  • Coppermine newbie
  • Offline Offline
  • Posts: 19
Re: basic cpmfetch code
« Reply #5 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....
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: basic cpmfetch code
« Reply #6 on: February 04, 2007, 10:13:53 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
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

bcddd214

  • Coppermine newbie
  • Offline Offline
  • Posts: 19
Re: basic cpmfetch code
« Reply #7 on: February 04, 2007, 10:24:09 pm »

can you possibly put it in example format?
Logged

bcddd214

  • Coppermine newbie
  • Offline Offline
  • Posts: 19
Re: basic cpmfetch code
« Reply #8 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();
?>
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: basic cpmfetch code
« Reply #9 on: February 04, 2007, 10:46:09 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.





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

bcddd214

  • Coppermine newbie
  • Offline Offline
  • Posts: 19
Re: basic cpmfetch code
« Reply #10 on: February 04, 2007, 10:49:53 pm »

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
Logged

bcddd214

  • Coppermine newbie
  • Offline Offline
  • Posts: 19
Re: basic cpmfetch code
« Reply #11 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....
Logged

bcddd214

  • Coppermine newbie
  • Offline Offline
  • Posts: 19
Re: basic cpmfetch code
« Reply #12 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();
?>
Logged

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: basic cpmfetch code
« Reply #13 on: February 04, 2007, 11:03:46 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.




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: basic cpmfetch code
« Reply #14 on: February 04, 2007, 11:04:33 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?


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

bcddd214

  • Coppermine newbie
  • Offline Offline
  • Posts: 19
Re: basic cpmfetch code
« Reply #15 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.....
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: basic cpmfetch code
« Reply #16 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?
Logged
It is a mistake to think you can solve any major problems just with potatoes.

vuud

  • Moderator
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1803
  • [cpmfetch.fistfullofcode.com]
    • Fist Full Of Code
Re: basic cpmfetch code
« Reply #17 on: February 05, 2007, 12:08:50 am »

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

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: basic cpmfetch code
« Reply #18 on: February 05, 2007, 12:17:27 am »

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:
Code: [Select]
$sqlcode = "SELECT " . $this->sqlPictureAlbumSelect . " FROM " . $this->cpm_table_prefix
And add this:

Code: [Select]
. $this->cpm_table_prefix . "users AS u,  "
so it looks like so:

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




 


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

bcddd214

  • Coppermine newbie
  • Offline Offline
  • Posts: 19
Re: basic cpmfetch code
« Reply #19 on: February 05, 2007, 12:45:52 am »

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

Page created in 0.028 seconds with 19 queries.