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

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

vuud

Quote from: CPG Guru on December 26, 2005, 03:15:34 PM
Hi Dear Vuud

Ive tried this but didnt succeed, wht ive done is

1) joomla : in root
2) CPG 1 gallery : site.com/gallery1
3) CPG 1 gallery : site.com/gallery2

& ive made 2 cpmfetch folders in root like :

1) www.site.com/cpmfetch ( in cpmfetch.php ive chnge path to gallery1 )
2) www.site.com/cpmfetch1 ( in cpmfetch.php ive chnge path to gallery2 )

Now as u told ive paste tag (this pics was actually in table)


<table width="100%"  border="0" cellspacing="0" cellpadding="0">
                  <tr align="center" valign="middle">
                    <th scope="col"><?php
include "./cpmfetch1/cpmfetch.php";
$objCpm1 = new cpm('/gallery2');
?>
</th>
                    <th scope="col">&nbsp;</th>
                  </tr>
                  <tr align="center" valign="middle">
                    <th scope="col"><?php $objCpm1->cpm_viewRandomMediaFrom(1,1,"cat=2");  ?>
</th>
                    <th scope="col"><?php $objCpm1->cpm_viewRandomMediaFrom(1,1,"cat=2");  ?>
</th>
                  </tr>
                  <tr align="center" valign="middle">
                    <td><?php $objCpm1->cpm_viewRandomMediaFrom(1,1,"cat=2");  ?>
                      <div align="center"></div>
                    <div align="center"></div></td>
                    <td><?php $objCpm1->cpm_viewRandomMediaFrom(1,1,"cat=2");  ?>
                    <div align="center"></div></td>
                  </tr>
                </table><?php $objCpm1->cpm_close(); ?>



Before & after pasting this gallery 1 was working fine but the gallery 2 shows this error

Fatal error: Cannot redeclare class cpm_dao in /home/SITENAME/public_html/cpmfetch1/cpmfetch_dao.php on line 22

Please suggest :)

Regards

Rahul



This is great, but I either messed up when I told you (I am too tired to go back and check) or you missed one important part.

If I strip out all the annoying html code in there we have this


include "./cpmfetch1/cpmfetch.php";
$objCpm1 = new cpm('/gallery2');
$objCpm1->cpm_viewRandomMediaFrom(1,1,"cat=2");
$objCpm1->cpm_viewRandomMediaFrom(1,1,"cat=2");
$objCpm1->cpm_viewRandomMediaFrom(1,1,"cat=2"); 
$objCpm1->cpm_viewRandomMediaFrom(1,1,"cat=2");
$objCpm1->cpm_close();


I have this sense of deja vu, so forgive me if I went over this before

If you want to display images from two different galleries on the same page, you could do it like this:


include "./cpmfetch1/cpmfetch.php";
$objCpm1 = new cpm('/gallery1');
$objCpm2 = new cpm('/gallery2');

$objCpm1->cpm_viewRandomMediaFrom(1,1,"cat=2");
$objCpm1->cpm_viewRandomMediaFrom(1,1,"cat=2");

$objCpm2->cpm_viewRandomMediaFrom(1,1,"cat=2"); 
$objCpm2->cpm_viewRandomMediaFrom(1,1,"cat=2");

$objCpm1->cpm_close();
$objCpm2->cpm_close();




Notice I created an $objCpm1 and $objCpm2?

You should only need a include "./cpmfetch/cpmfetch.php";

Both can work out of that.




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

benseth

How do i make it that One photo from the album is showing for a catogory instead of all the pictures?
here's my code
<head>

<style type="text/css">
BODY { MARGIN: 0px; font-size: 9px; font-family:tahoma; color:#000000; letter-spacing: 0px; font-weight: none; text-align: lest; line-height:1.1}

I{COLOR:#DCDCDC}
B{COLOR:#C4EADF}
U{COLOR:#F2C280}

LI {FONT-SIZE: 9px;  font-family:tahoma; letter-spacing: 0px; font-weight: none; text-align: lest; line-height:1.1}

A:link   {FONT-WEIGHT:bold; COLOR:#7ADBE2;TEXT-DECORATION:none}
A:visited {FONT-WEIGHT:bold;COLOR:#7ADBE2; TEXT-DECORATION:none}
A:active {FONT-WEIGHT:bold;COLOR:#7ADBE2; TEXT-DECORATION: none}
A:hover  {FONT-WEIGHT:bold;COLOR:#FFFFFF; TEXT-DECORATION: none;}

TR {font-size: 9px; font-family:tahoma; color:#ADADAD; letter-spacing: 0px; font-weight: none; text-align: center; line-height:1.1}
TD {font-size: 9px; font-family:tahoma; color:#ADADAD; letter-spacing: 0px; font-weight: none; text-align: center; line-height:1.1}

}



</style>

<style type="text/css">
.test1 {  border-style:solid;
          border-width:0px;
          border-color: #FFFFFF;
          margin: 1px;
          background: #FFFFFF; }
</style>
</head>
<body>
<center>
<?php
   include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewLastAddedMedia(30,1,array("subtitle" => "%a", "tablestyle" => "test1","imagestyle" => "test1" , "windowtarget" => "_blank-js"));
$objCpm->cpm_close();
?>
</center>

imrich

Quote from: vuud on December 28, 2005, 08:16:03 AM
Thanks for posting this!  I have no idea what the tables are over there so this helps.

Thanks again for the contribution


You are very welcome! It just so happened that user_id is the same for the CPG tables as it is for the phpbb tables.  There are some other very common items also.

I was looking for some abstraction or functions which would get the particular items from the database, but I didn't find them. My guess is that the ultimate change would be to have your cpmfetch functions to use coppermine bridge routines. This was as people make new bridges, cpmfetch will go along for the ride and will just work too.

I've done more testing and all that I've tested seems to work.

I did see that the number of views in cftest.php did not work, but they also didn't work in the raw cpmfetch 1.6.2 code which I downloaded either. ;)

I hope someone will find this useful as I know there are a lot of people using phpbb.

vuud

Quote from: benseth on December 28, 2005, 08:41:33 AM
How do i make it that One photo from the album is showing for a catogory instead of all the pictures?
here's my code
<head>

<style type="text/css">
BODY { MARGIN: 0px; font-size: 9px; font-family:tahoma; color:#000000; letter-spacing: 0px; font-weight: none; text-align: lest; line-height:1.1}

I{COLOR:#DCDCDC}
B{COLOR:#C4EADF}
U{COLOR:#F2C280}

LI {FONT-SIZE: 9px;  font-family:tahoma; letter-spacing: 0px; font-weight: none; text-align: lest; line-height:1.1}

A:link   {FONT-WEIGHT:bold; COLOR:#7ADBE2;TEXT-DECORATION:none}
A:visited {FONT-WEIGHT:bold;COLOR:#7ADBE2; TEXT-DECORATION:none}
A:active {FONT-WEIGHT:bold;COLOR:#7ADBE2; TEXT-DECORATION: none}
A:hover  {FONT-WEIGHT:bold;COLOR:#FFFFFF; TEXT-DECORATION: none;}

TR {font-size: 9px; font-family:tahoma; color:#ADADAD; letter-spacing: 0px; font-weight: none; text-align: center; line-height:1.1}
TD {font-size: 9px; font-family:tahoma; color:#ADADAD; letter-spacing: 0px; font-weight: none; text-align: center; line-height:1.1}

}



</style>

<style type="text/css">
.test1 {  border-style:solid;
          border-width:0px;
          border-color: #FFFFFF;
          margin: 1px;
          background: #FFFFFF; }
</style>
</head>
<body>
<center>
<?php
   include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewLastAddedMedia(30,1,array("subtitle" => "%a", "tablestyle" => "test1","imagestyle" => "test1" , "windowtarget" => "_blank-js"));
$objCpm->cpm_close();
?>
</center>


Do you mean the photo the coppermine photo gallery shows for that category?


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: imrich on December 28, 2005, 01:49:58 PM
You are very welcome! It just so happened that user_id is the same for the CPG tables as it is for the phpbb tables.  There are some other very common items also.

I was looking for some abstraction or functions which would get the particular items from the database, but I didn't find them. My guess is that the ultimate change would be to have your cpmfetch functions to use coppermine bridge routines. This was as people make new bridges, cpmfetch will go along for the ride and will just work too.

I doubt that this will happen...  at least anytime soon.  Once I did that, then I am forced in lockstep with the whole CPG system - which does a great job but has a different design objective. 

My short term plan is to cut off the connection that fails when it is bridged (people will not be able to display the author though) and then add in some of the bridges I guess.   The biggest pain is not having all of the bridges set up here.  So I will probably take solicitations with a database layout provided. 

Quote
I've done more testing and all that I've tested seems to work.

I did see that the number of views in cftest.php did not work, but they also didn't work in the raw cpmfetch 1.6.2 code which I downloaded either. ;)

What? the number of views for a photo was / is not working?

Quote
I hope someone will find this useful as I know there are a lot of people using phpbb.


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

imrich

Quote from: vuud on December 28, 2005, 04:58:44 PM

What? the number of views for a photo was / is not working?



I understand what you are saying about the database. If I was better at db work, I would volunteer to help, but I'm not! ;)

If you run cftest.php, Under the test thumbnail grid, 'Views' always shows 0.  Even on my test installation which does not have any phpbb installed.  I noticed that the code had %V instead of %v, I tried to change it to %v, but it didn't seem to work. However, I didn't do much more testing than that.


vuud

Quote from: imrich on December 28, 2005, 05:16:25 PM
I understand what you are saying about the database. If I was better at db work, I would volunteer to help, but I'm not! ;)

If you run cftest.php, Under the test thumbnail grid, 'Views' always shows 0.  Even on my test installation which does not have any phpbb installed.  I noticed that the code had %V instead of %v, I tried to change it to %v, but it didn't seem to work. However, I didn't do much more testing than that.



Its not hard DB work...   Its just I am not going to install every supported Portal to get the db layout for that side :D

I noted about views... I will be sure to check that for next release!
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

chican0

Quote from: vuud on December 28, 2005, 08:24:16 AM
If you want to deal with the manual install...  the next version is a whole re-write of the option and directory handling.

I hate writting installers.

hate it.

Thanks for your response vuud. Hope your holidays were good to you.

I don't mind a manual install for now. If you have the time, I have the time. :)

If not, then I can wait. Whatever is easiest on you.

By the way, is it possible to make a financial donation for this?

vuud

Quote from: chican0 on December 28, 2005, 05:41:14 PM
Thanks for your response vuud. Hope your holidays were good to you.

I don't mind a manual install for now. If you have the time, I have the time. :)

If not, then I can wait. Whatever is easiest on you.

By the way, is it possible to make a financial donation for this?

I am going to start taking some donations, and also offer customization services for those using it in a commercial capacity (ie: if you are making money off it, I will let you pay me to help you).

Home, personal and non-profits don't apply to that though
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

benseth

Quote from: vuud on December 28, 2005, 04:52:32 PM

Do you mean the photo the coppermine photo gallery shows for that category?



Like how the person did this http://www.slave4u.com/celebrities/latest.php
They show One image from the category i think it's the first picture/or latest from the album, Instead of having all the pictures.

ZakRhino

Quote from: vuud on December 13, 2005, 06:28:08 AM
Ah sorry... that sets the table html tag to have class="test1".  So for you it does nothing.

I should have removed it... it means nothing to you unless you want to add test1 to you stylesheet

Hope its all better

Call this dumb but when I remove it, It said (PHP) that I had an error on that line b/c I remove the test1 O_o Werid! But I put it back and it works there no test1 in my CSS at all. Also is there a way to make the image be change ever day or with in a time period of hours?

vuud

Quote from: ZakRhino on December 29, 2005, 03:34:24 AM
Call this dumb but when I remove it, It said (PHP) that I had an error on that line b/c I remove the test1 O_o Werid! But I put it back and it works there no test1 in my CSS at all. Also is there a way to make the image be change ever day or with in a time period of hours?

You must have messed up the options array format when you removed it then.

Creating a syntax error.

Post the broken line if you want to remove it... But make sure you are removing both parts of the test1 entry... the key and the value.
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: benseth on December 29, 2005, 01:12:56 AM
Like how the person did this http://www.slave4u.com/celebrities/latest.php
They show One image from the category i think it's the first picture/or latest from the album, Instead of having all the pictures.

Like:

cpm_viewLastAddedMediaFrom ( 1, 1, "cat=48");

This would use category 48

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

benseth

Quote from: vuud on December 29, 2005, 04:32:11 AM
Like:

cpm_viewLastAddedMediaFrom ( 1, 1, "cat=48");

This would use category 48


No no, like what i ment was.  I have selected cat's 43 44 45 46 47 48  and 49.  Each time i add new files, all the filies are showen.  What i want is One file from each album shown instead of all of them.  Such as the link i posted before, where the first picture is shown with the album while when you click on it.. there's is the full set.

my code is

<head>

<style type="text/css">
BODY { MARGIN: 0px; font-size: 9px; font-family:tahoma; color:#000000; letter-spacing: 0px; font-weight: none; text-align: lest; line-height:1.1}

I{COLOR:#DCDCDC}
B{COLOR:#C4EADF}
U{COLOR:#F2C280}

LI {FONT-SIZE: 9px;  font-family:tahoma; letter-spacing: 0px; font-weight: none; text-align: lest; line-height:1.1}

A:link   {FONT-WEIGHT:bold; COLOR:#7ADBE2;TEXT-DECORATION:none}
A:visited {FONT-WEIGHT:bold;COLOR:#7ADBE2; TEXT-DECORATION:none}
A:active {FONT-WEIGHT:bold;COLOR:#7ADBE2; TEXT-DECORATION: none}
A:hover  {FONT-WEIGHT:bold;COLOR:#FFFFFF; TEXT-DECORATION: none;}

TR {font-size: 9px; font-family:tahoma; color:#ADADAD; letter-spacing: 0px; font-weight: none; text-align: center; line-height:1.1}
TD {font-size: 9px; font-family:tahoma; color:#ADADAD; letter-spacing: 0px; font-weight: none; text-align: center; line-height:1.1}

}



</style>

<style type="text/css">
.test1 {  border-style:solid;
          border-width:0px;
          border-color: #FFFFFF;
          margin: 1px;
          background: #FFFFFF; }
</style>
</head>
<body>
<center>
<?php
   
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewLastAddedMedia(30,1,array("cat"=>"43,44,45,46,47,48,49,""subtitle" => "%a""tablestyle" => "test1","imagestyle" => "test1" "windowtarget" => "_blank"));
$objCpm->cpm_close();
?>

</center>

fcarentz

Quote from: vuud on December 28, 2005, 08:21:41 AM
Try this (for lack of anything better to suggest)

$objCpm->cpm_viewRandomMediaFromAlbum(1, 1, 28, $options);

I could not get to your site as mysite.com... or is that just an example?

I remember poking at your site I think (you PM'd me right?) and thought it all looked okay (at least that it should work)






Yea tried that it didnt work.

Yes the mysite.com was just an example...the site url is http://theminivault.grimeygames.com

I just ended up using the SSI

ZakRhino

Quote from: vuud on December 29, 2005, 04:28:47 AM
You must have messed up the options array format when you removed it then.

Creating a syntax error.

Post the broken line if you want to remove it... But make sure you are removing both parts of the test1 entry... the key and the value.

This is the code

------
<?php
   include "./CopperMineFetch/cpmfetch.php";
   $objCpm = new cpm("/Galleries");
   $objCpm->cpm_viewRandomMedia(1,1,array("tablestyle" => "test1","imagestyle" => "RandomImageBorder"));
   $objCpm->cpm_close();
?>
--------


Is it also possible to make the image gernal daily or with in a hourly time frame?

CPG Guru

QuoteThis is great, but I either messed up when I told you (I am too tired to go back and check) or you missed one important part.

If I strip out all the annoying html code in there we have this


include "./cpmfetch1/cpmfetch.php";
$objCpm1 = new cpm('/gallery2');
$objCpm1->cpm_viewRandomMediaFrom(1,1,"cat=2");
$objCpm1->cpm_viewRandomMediaFrom(1,1,"cat=2");
$objCpm1->cpm_viewRandomMediaFrom(1,1,"cat=2"); 
$objCpm1->cpm_viewRandomMediaFrom(1,1,"cat=2");
$objCpm1->cpm_close();


I have this sense of deja vu, so forgive me if I went over this before

If you want to display images from two different galleries on the same page, you could do it like this:


include "./cpmfetch1/cpmfetch.php";
$objCpm1 = new cpm('/gallery1');
$objCpm2 = new cpm('/gallery2');

$objCpm1->cpm_viewRandomMediaFrom(1,1,"cat=2");
$objCpm1->cpm_viewRandomMediaFrom(1,1,"cat=2");

$objCpm2->cpm_viewRandomMediaFrom(1,1,"cat=2"); 
$objCpm2->cpm_viewRandomMediaFrom(1,1,"cat=2");

$objCpm1->cpm_close();
$objCpm2->cpm_close();




Notice I created an $objCpm1 and $objCpm2?

You should only need a include "./cpmfetch/cpmfetch.php";

Both can work out of that.




Dear

ive done the following

1) Paste the following code

include "./cpmfetch1/cpmfetch.php";
$objCpm1 = new cpm('/gallery1');
$objCpm2 = new cpm('/gallery2');

$objCpm1->cpm_viewRandomMediaFrom(1,1,"cat=2");
$objCpm1->cpm_viewRandomMediaFrom(1,1,"cat=2");

$objCpm2->cpm_viewRandomMediaFrom(1,1,"cat=2"); 
$objCpm2->cpm_viewRandomMediaFrom(1,1,"cat=2");

$objCpm1->cpm_close();
$objCpm2->cpm_close();

But it only shows  gallery 1 images

    2)            Even ive tried this :-

In cpmfetch.php ive cleared path to galery & use it as below & upload in ./cpmfetch1/ 

// //////////////////// NO USER SERVICEABLE PARTS BEYOND THIS POINT ////////////////////////

   var $VERSION = "1.6.2";
   var $cpm = "1.4.2";
   var $urltocpm = "";       //from a web client point of view without domain name /photos
   var $filepathtocpm = "";  //server path to cpm directory  /home/vuud/cpm


But no success :(

Now take this i want to have fresh install of Cpmfetch MOD for 2 galleries

Tell me few answers :-

1) In root directory ive to make 2 cpmfetch folders or 1 (ex. site.com/cpmfetch & site.com/cpmfetch1)

2) In cpmfetch.php ive to edit or gallery path or not If yes then > ( if copy 2 cpmfetch folders as describe in No.1  ive to edit both cpmfetch.php the real path to gallery)

Test it on your site also if possible please send me link i want to have a look


Please Suggest !!!!!  :)

n3n

Hi Vuud, im back again.
Switched webhost from IIS to Apache. (special for fetch :P)
But again I seem to have a problem with Fetch. At first it was giving me an opendir error, but
after moving the Fetch files to the root it was ok. But still im not getting any images ?
Got time to help me a bit ?

Running latest version of Joomla/Coppermine/Copperminefetch PHP5/Apache2


Cheers (again  :-[)

vuud

Quote from: benseth on December 29, 2005, 08:29:52 AM
No no, like what i ment was.  I have selected cat's 43 44 45 46 47 48  and 49.  Each time i add new files, all the filies are showen.  What i want is One file from each album shown instead of all of them.  Such as the link i posted before, where the first picture is shown with the album while when you click on it.. there's is the full set.


<?php
   
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewLastAddedMedia(30,1,array("cat"=>"43,44,45,46,47,48,49,""subtitle" => "%a""tablestyle" => "test1","imagestyle" => "test1" "windowtarget" => "_blank"));
$objCpm->cpm_close();
?>

</center>


Ahhhh.  I grok.

No.  To do that you really need to make multiple calls to get one from each.


$options = array("subtitle" => "%a", "tablestyle" => "test1","imagestyle" => "test1" , "windowtarget" => "_blank");
$objCpm->cpm_viewLastAddedMediaFrom(1,1,"cat=41",$options);
$objCpm->cpm_viewLastAddedMediaFrom(1,1,"cat=42",$options);
$objCpm->cpm_viewLastAddedMediaFrom(1,1,"cat=43",$options);
$objCpm->cpm_viewLastAddedMediaFrom(1,1,"cat=44",$options);
$objCpm->cpm_viewLastAddedMediaFrom(1,1,"cat=44",$options);


Of course each will have their own tables... which will suck.

You could also just get back the data and format each display one at a time... but that would take some doing.



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: ZakRhino on December 29, 2005, 11:55:10 AM
This is the code

------
<?php
   include "./CopperMineFetch/cpmfetch.php";
   $objCpm = new cpm("/Galleries");
   $objCpm->cpm_viewRandomMedia(1,1,array("tablestyle" => "test1","imagestyle" => "RandomImageBorder"));
   $objCpm->cpm_close();
?>
--------


Is it also possible to make the image gernal daily or with in a hourly time frame?

$objCpm->cpm_viewRandomMedia(1,1,array("imagestyle" => "RandomImageBorder"));

Nope, its not possible to do an hourly or anything.  If you have cron access you could concievably schedule a script to grab a new one each hour, but cpmfetch does not provide for any sort of state keeping.  With a bit of php code you could create something that does that using cpmfetch

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