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

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

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

CPG Guru

Dear Vuud

My details are

CMS : Joomla
CPG : 1.4 (new)
forum : smf
My knowledge : INtermediate
server: linux

Im having 3 CPG galleries on my site

1) www.mysite.com / WALLPAPER
2) www.mysite.com / LOGOS
3) www.mysite.com / MOVIES

& ive ive installed your Excellent MOD cpmfetch for random wallpapers on  joomla index page & now i want to fetch data from logo gallery & movies gallery

If i copy mod to other folders & after filling necessary details (path to movies cpg etc.) i post for 2 other galleries on index page it says error of cant redeclare

Hope u understand : In simple words if i want to fetch data form 3 different  galleries installed on one same site to one same index page .. How is that possible ?

Please tell me what & How to do

Regards



fcarentz

1. Coppermine 1.4.2
2. http://theminivault.grimeygames.com/gallery 
3. http://theminivault.grimeygames.com/ - The Fetch table on the righthand side
4. Intermediate
5. Apache
6. There is no syntax error or mysql error. Everything seems to be runnig correctly. However I am not retreiving anything except content from the very first user gallery.


          <?php 
include 
"./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$options = array('alttag'=>"Posted By: %o",'imagewidth'=>"100");
$objCpm->cpm_viewLastAddedMedia (51$options);
$objCpm->cpm_close();
          
?>



This will result with images being pulled back but only those images that have been added to album 1...not sure what I need to change. I have tried to use


$objCpm->cpm_viewLastAddedMediaFrom(5,1,"cat=1",$options);


With the same results. I want to display the last 5 added images from any personal galleries. I do know for a fact that user 1 was not the last files uploaded as I uploaded them myself and have have many more added after I had done it. Any help would be greatly appreciated.

Thanks in advance.


vuud

Quote from: CPG Guru on December 20, 2005, 05:20:26 PM
Dear Vuud

My details are

CMS : Joomla
CPG : 1.4 (new)
forum : smf
My knowledge : INtermediate
server: linux

Im having 3 CPG galleries on my site

1) www.mysite.com / WALLPAPER
2) www.mysite.com / LOGOS
3) www.mysite.com / MOVIES

& ive ive installed your Excellent MOD cpmfetch for random wallpapers on  joomla index page & now i want to fetch data from logo gallery & movies gallery

If i copy mod to other folders & after filling necessary details (path to movies cpg etc.) i post for 2 other galleries on index page it says error of cant redeclare

Hope u understand : In simple words if i want to fetch data form 3 different  galleries installed on one same site to one same index page .. How is that possible ?

Please tell me what & How to do

Regards


Without trying it myself...

1) Make sure you are closing with $objCpm->cpm_close() before starting the next one.

If that does not work, give them different names...

$objCpm1 = new cpm("/gallery");
$objCpm1->cpm_viewLastAddedMedia (5, 1, $options);
$objCpm1->cpm_close();
 
$objCpm2 = new cpm("/other");
$objCpm2->cpm_viewLastAddedMedia (5, 1, $options);
$objCpm2->cpm_close();


If none of that works, post exactly what it is saying it cannot redeclare

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

vuud


I have a maurauder figure half done somewhere... I used to do a lot of those - warhammer and before that.  But all my paints are dried up and the brushes are lost... sigh

Anyway...

I am not sure I ever tested for subdirectories in personal albums - that could be the problem.  I've added it to my list of things to test.






Quote from: fcarentz on December 21, 2005, 05:03:44 AM
1. Coppermine 1.4.2
2. http://theminivault.grimeygames.com/gallery 
3. http://theminivault.grimeygames.com/ - The Fetch table on the righthand side
4. Intermediate
5. Apache
6. There is no syntax error or mysql error. Everything seems to be runnig correctly. However I am not retreiving anything except content from the very first user gallery.


          <?php 
include 
"./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$options = array('alttag'=>"Posted By: %o",'imagewidth'=>"100");
$objCpm->cpm_viewLastAddedMedia (51$options);
$objCpm->cpm_close();
          
?>



This will result with images being pulled back but only those images that have been added to album 1...not sure what I need to change. I have tried to use


$objCpm->cpm_viewLastAddedMediaFrom(5,1,"cat=1",$options);


With the same results. I want to display the last 5 added images from any personal galleries. I do know for a fact that user 1 was not the last files uploaded as I uploaded them myself and have have many more added after I had done it. Any help would be greatly appreciated.

Thanks in advance.


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

fcarentz

Thats cool, it seems coding and painting minis goes hand in hand. HAHA, must be something about enjoying tedious tasks. LOL

To the subject at hand:

The funny thing is even the get Random only pulls from the first Personal Album and not from everything?

JoeyE

I am totally lost on this. I am not sure if I coded this correctly. I am trying to use the owner=xxxxx for the $source. But nothing happens.
Here is where I am trying to use it:

Example: http://viscomcreatives.org/?author=12
<?php
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm('/photo');
$objCpm->cpm_viewRandomMedia (3,4,"cat=1:owner=Joey Esquivel");
$objCpm->cpm_close();
?>


At the moment, it just does a random image from all the albums. The way I have my coppermine gallery set up is that I have one category with each user creating their own albums within that one category. I would like to ultimately just list the albums per each user. But I am unaware of how to do this. So for now I would simply like to have random images from just that specific user's albums. Any advice would be a great bit of help. Thank you.

fcarentz

Ok so I created a new album to try and workaround this issue. Changed the whole site so now it only pulls images that are in one specific album, but unfortunatley now it always pulls the same image back.

I create the object in the page header and close it in the footer and the following code is where it is pulling the image from the gallery. And still nothing. I only want to pull one images at random from album 38.

My server structure is

Page with linked images.: http://mysite.com/index.php
cpmFetch: http://mysite.com/cpmfetch/cpmfetch.php
gallery installation: http://mysite.com/gallery

My header is
require_once "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");



My Call to spmfetch is this

<?php 
$source 
"album=38";
$options = array('subtitle' => 'Posted By: %o','alttag'=>"%c"'tablestyle' => 'rate''imagewidth'=>"100",'imagestyle' => 'rate');
$objCpm->cpm_viewRandomMediaFrom(11$source$options);
$objCpm->cpm_close();
?>



MrTeck

Firts of all, tnx u very much VuuD.

Why no make a recopilation of the blocks?
I use this:
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fimg445.imageshack.us%2Fimg445%2F6899%2Fsamplecfetch7kj.jpg&hash=cc8e5e6a5b229778fd78cd6379a06886204ac87f)

And the code is:
<?php
echo '
<style type="text/css"><!--
.test1 {  border-width:0px;}
--></style>'
;

echo 
'<div align="center">';
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/coppermine");
echo 
' <div align="center">'
echo 
' <b><u>Stats</u></b><br>'
$objCpm->cpm_formatStats("Albums: <b>%a</b> <br> Images: <b>%f</b> <br> Clicks: <b>%v</b> <br> Comments: <b>%n</b> <br><br>");
echo 
'</div>';

echo 
' <b><u>Last Image</u></b><br>'
$options = array( 'subtitle' => '<b>%a</b> <br> Name: <b>%t</b> Author: <b>%o</b> <br> Here since <b>%D</b> days <br> Clicks: <b>%h</b> <br> Score: <b>%V</b>' "imagestyle" => "test1");
$objCpm->cpm_viewLastAddedMedia(1,1,$options,);

//$objCpm->cpm_close(); 
echo'</div>';
?>

chican0

Quote from: vuud on November 30, 2005, 09:14:48 AM
Sort a teaser, and to at least get myself motivated to finish it...

I have version 1.7.0 almost done.  Well, the code itself is, but the installer is not.  I took a day off and did nothing but recode the whole thing.

Yes, thats right - an installer.

The biggest plus for me is that I eliminated a lot of code and duplication.

The biggest plus for all of you is that

1) You will set the configuration once, and no matter what you do, all the programs know to read it. 

2) The configuration gets built of CPG settigns data, so no more futzing with setting prefixes and such

3) Support for cpg 1.4

4) Support to make bridging at least not a problem

5) Should be more IIS and other wierd server tolerant

6) I think the double backslash thing is gone

The big drawback is that this product contains WHEAT and SOY.  So those with allergies could have a problem.  PEANUT safe though.

Oh yeah, and some functions are going away, BUT the normal ones are still available to you - so you should only need to make very minor changes to your web pages. 

$objcpm = new cpmfetch("/cpg");

now becomes

$objcpm = new cpmfetch();

All thats left is to make the installer that builds your config files and a few tweaks to the data.

So hopefully in a day or two.

I am not taking feature requests specifically for this release, but if anyone has any gripes about something that was hard to do that I can make easier, now would be a good time to point it out to me.

Have a nice night and lets all hope for the best


I just need to eliminate the double slashed (//). Is there any way to get the fix for that?

By the way... supurb script.

baal32

Using cpm 1.33, phpbb 2.0.15, cpmfetch 1.6.2
The problem appears to be that when using the cpm-phpbb bridge all user info is actually stored in the phpbb database leaving the cpm users table storing only an admin user.  This causes problems in cpmfetch_dao wherein resultsets are generated joining the pictures and users tables on the user_id (select ...... where .... AND p.owner_id = u.user_id) because the users table is essentially empty, which of course yields an empty set. 

I'm not a php expert and certainly not overly familiar with the cpmfetch code so I'm not sure how difficult it would be to get the code to join against the phpbb_users table instead of the cpg table.

Thanks

CPG Guru

Quote from: vuud on December 21, 2005, 05:25:18 PM

Without trying it myself...

1) Make sure you are closing with $objCpm->cpm_close() before starting the next one.

If that does not work, give them different names...

$objCpm1 = new cpm("/gallery");
$objCpm1->cpm_viewLastAddedMedia (5, 1, $options);
$objCpm1->cpm_close();
 
$objCpm2 = new cpm("/other");
$objCpm2->cpm_viewLastAddedMedia (5, 1, $options);
$objCpm2->cpm_close();


If none of that works, post exactly what it is saying it cannot redeclare

Vuud


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









imrich

Quote from: vuud on December 06, 2005, 06:02:02 AM
I can try.  Bear in mind I may forget a step, but you should be able to figure it out from there.

1. Log into coppermine gallery as an admin
2. Click on "users" from the admin menu
3. Click "new user"
4. Give the new user a funny name... this is important.

Important note:  There is a difference between funny and offensive.  I would strongly suggest the former over the latter.  Examples of funny names would be like:

Balzack Blisterfrog
Tuggmabellz Fugnutter
Licquema Svettynutz
I.P. Daily
Etc.

Offensive user names are like offensive passwords.  They have a habit of being revealed at the worst times.

5. Assign the user whatever for a password since you will never use it again.

Now repeat the above steps 3-5 once for each PHPBB user you have adding photos.  Step 4 will be the most challenging as coming up with funny names is not as easy as it seems.  Alternatively you could go with the names of the seven dwarfs if you could remember them and if you have less than 8 users to add.

Good luck

Baron Von Flatulator

( I appologize if anyone reading this actually has one of those names.  I mean, I am really really sorry if you have one of those names)


First, I want to thank vuud for an incredible add on to Coppermine! :D

My Coppermine 1.3.5 is bridged with phpbb 2.0.18.

I have a bunch of users in my phpbb forum (about 100) and thought this 'make up some fake users in the Coppermine database' was just too much work for me (lazyness is the mother of most of my coding), so I thought take this as a 'hint' by vuud to what may be a minimal change to the code to allow it to work with the PHPBB database.

First (and this is important), I have both my coppermine and my phpbb data in the same mysql database. My phpbb database has a phpbb prefix (i.e. phpbb_).  This is important to allow this 'hack' to work!

I made some rather simple-minded changes to cpmfetch_dao.php in an attempt to get CpmFetch 1.6.2 to work with PHPBB 2.0.18.

Note, at this time, I'm using Coppermine version 1.3.5. I have NOT tested this yet with Coppermine 1.4.2.


I haven't done any significant testing, but it seems to work and cftest.php works too. ;)

open cpmfetch.dao.php and find line:

$this->sqlPictureSourceSelect = " " . $database_table_prefix . "pictures as p, " . $database_table_prefix . "albums as a, "
. $database_table_prefix . "users AS u ";


change it to the following:

$this->sqlPictureSourceSelect = " " . $database_table_prefix . "pictures as p, " . $database_table_prefix . "albums as a, "
. $database_table_prefix . "users AS u , phpbb_users AS phpbb ";


note! If your phpbb database tables have a different prefix than 'phpbb_' then change the phpbb_users as needed to use the same prefix as your phpbb database tables use.

THEN, find every occurance of u.user_id and change it to phpbb.user_id

Save cpmfetch_dao.php and then try cftest.php.

If you get a chance to try this with Coppermine 1.4.2 bridge with PHPBB 2.0.18 and it works ok, I'd appreciate someone letting me know. If I get a chance to upgrade to cpg 1.4.2 myself, I'll let you know.

vuud

Quote from: mini1400 on December 22, 2005, 06:33:39 PM
Is there any way of getting the exif date as a parameter for subtitle in the $options array?

Not unless someone submits some code to do this :)

Also I am running out of $a, %b, etc markers... I will have to switch to %aa% in the future...

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: JoeyE on December 21, 2005, 11:20:45 PM
I am totally lost on this. I am not sure if I coded this correctly. I am trying to use the owner=xxxxx for the $source. But nothing happens.
Here is where I am trying to use it:

Example: http://viscomcreatives.org/?author=12
<?php
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm('/photo');
$objCpm->cpm_viewRandomMedia (3,4,"cat=1:owner=Joey Esquivel");
$objCpm->cpm_close();
?>



At the moment, it just does a random image from all the albums. The way I have my coppermine gallery set up is that I have one category with each user creating their own albums within that one category. I would like to ultimately just list the albums per each user. But I am unaware of how to do this. So for now I would simply like to have random images from just that specific user's albums. Any advice would be a great bit of help. Thank you.

Strange... can you tell me where you saw that owner or author was a valid tag for the source block?


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 26, 2005, 10:48:35 PM
First, I want to thank vuud for an incredible add on to Coppermine! :D

My Coppermine 1.3.5 is bridged with phpbb 2.0.18.

I have a bunch of users in my phpbb forum (about 100) and thought this 'make up some fake users in the Coppermine database' was just too much work for me (lazyness is the mother of most of my coding), so I thought take this as a 'hint' by vuud to what may be a minimal change to the code to allow it to work with the PHPBB database.

First (and this is important), I have both my coppermine and my phpbb data in the same mysql database. My phpbb database has a phpbb prefix (i.e. phpbb_).  This is important to allow this 'hack' to work!

I made some rather simple-minded changes to cpmfetch_dao.php in an attempt to get CpmFetch 1.6.2 to work with PHPBB 2.0.18.

Note, at this time, I'm using Coppermine version 1.3.5. I have NOT tested this yet with Coppermine 1.4.2.


I haven't done any significant testing, but it seems to work and cftest.php works too. ;)

open cpmfetch.dao.php and find line:

$this->sqlPictureSourceSelect = " " . $database_table_prefix . "pictures as p, " . $database_table_prefix . "albums as a, "
. $database_table_prefix . "users AS u ";


change it to the following:

$this->sqlPictureSourceSelect = " " . $database_table_prefix . "pictures as p, " . $database_table_prefix . "albums as a, "
. $database_table_prefix . "users AS u , phpbb_users AS phpbb ";


note! If your phpbb database tables have a different prefix than 'phpbb_' then change the phpbb_users as needed to use the same prefix as your phpbb database tables use.

THEN, find every occurance of u.user_id and change it to phpbb.user_id

Save cpmfetch_dao.php and then try cftest.php.

If you get a chance to try this with Coppermine 1.4.2 bridge with PHPBB 2.0.18 and it works ok, I'd appreciate someone letting me know. If I get a chance to upgrade to cpg 1.4.2 myself, I'll let you know.


Thanks for posting this!  I have no idea what the tables are over there so this helps.

Thanks again for the contribution
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: fcarentz on December 22, 2005, 03:52:09 PM
Ok so I created a new album to try and workaround this issue. Changed the whole site so now it only pulls images that are in one specific album, but unfortunatley now it always pulls the same image back.

I create the object in the page header and close it in the footer and the following code is where it is pulling the image from the gallery. And still nothing. I only want to pull one images at random from album 38.

My server structure is

Page with linked images.: http://mysite.com/index.php
cpmFetch: http://mysite.com/cpmfetch/cpmfetch.php
gallery installation: http://mysite.com/gallery

My header is
require_once "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");



My Call to spmfetch is this

<?php 
$source 
"album=38";
$options = array('subtitle' => 'Posted By: %o','alttag'=>"%c"'tablestyle' => 'rate''imagewidth'=>"100",'imagestyle' => 'rate');
$objCpm->cpm_viewRandomMediaFrom(11$source$options);
$objCpm->cpm_close();
?>



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)




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: MrTeck on December 22, 2005, 09:30:27 PM
Firts of all, tnx u very much VuuD.

Why no make a recopilation of the blocks?
I use this:
(https://coppermine-gallery.com/forum/proxy.php?request=http%3A%2F%2Fimg445.imageshack.us%2Fimg445%2F6899%2Fsamplecfetch7kj.jpg&hash=cc8e5e6a5b229778fd78cd6379a06886204ac87f)

And the code is:
<?php
echo '
<style type="text/css"><!--
.test1 {  border-width:0px;}
--></style>'
;

echo 
'<div align="center">';
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/coppermine");
echo 
' <div align="center">'
echo 
' <b><u>Stats</u></b><br>'
$objCpm->cpm_formatStats("Albums: <b>%a</b> <br> Images: <b>%f</b> <br> Clicks: <b>%v</b> <br> Comments: <b>%n</b> <br><br>");
echo 
'</div>';

echo 
' <b><u>Last Image</u></b><br>'
$options = array( 'subtitle' => '<b>%a</b> <br> Name: <b>%t</b> Author: <b>%o</b> <br> Here since <b>%D</b> days <br> Clicks: <b>%h</b> <br> Score: <b>%V</b>' "imagestyle" => "test1");
$objCpm->cpm_viewLastAddedMedia(1,1,$options,);

//$objCpm->cpm_close(); 
echo'</div>';
?>


Is it just giving you a purple block?
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: chican0 on December 25, 2005, 06:45:11 AM
I just need to eliminate the double slashed (//). Is there any way to get the fix for that?

By the way... supurb script.

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.


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: baal32 on December 25, 2005, 10:15:07 PM
Using cpm 1.33, phpbb 2.0.15, cpmfetch 1.6.2
The problem appears to be that when using the cpm-phpbb bridge all user info is actually stored in the phpbb database leaving the cpm users table storing only an admin user.  This causes problems in cpmfetch_dao wherein resultsets are generated joining the pictures and users tables on the user_id (select ...... where .... AND p.owner_id = u.user_id) because the users table is essentially empty, which of course yields an empty set. 

I'm not a php expert and certainly not overly familiar with the cpmfetch code so I'm not sure how difficult it would be to get the code to join against the phpbb_users table instead of the cpg table.

Thanks

Someone posted this very thing just a few back...
http://forum.coppermine-gallery.net/index.php?topic=19564.msg117939#msg117939

Heck, I wrote the cpmfetch code and I don't know what half of it does (mostly kidding)


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