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

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

Titan85

Quote from: LooneyToonDad on June 14, 2006, 11:13:58 PM
In order to comment out the line you nee to put the /* before the start of the line's code and */ after the end of the line's code.

Put /* before the word "var" and put */ after the semicolon. It should look like this:

/* 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'; */
I didn't know to cancel out the whole line. That was the problem! Thanks for the help, I REALLY appreciate it.

Titan85

I have what could be a stupid question...Is there a way to use cpmfetch more than once on a page? For example, if i wanted to display the latest images from on album in one section of the page and display the latest images from another album on a different area of the page?

LooneyToonDad

Quote from: Titan85 on June 14, 2006, 11:38:39 PM
Thanks for the help, I REALLY appreciate it.

No problem. I'm very new at this stuff myself, so I'm not very good at explaining it yet, but since I had run into the same problem not 1 day before you did, I figured I'd try and help. Glad it's working now.

Quote from: LooneyToonDad on June 10, 2006, 04:11:47 PM
1. Where do I change the function/variable to only show certain media types. In other words, I only want photos to show up (.jpg, .png, .gif, etc) but not videos (.wmv, etc). I read the docs and know there is a function to do this, but I am unsure of what/where to change, and whether I list what I don't want seen, or do want seen.

2. Is there a way to limit the amount of characters shown when using the option "subtitle" => "%t"? If the image title is too long, I want to only show a set amount of characters so it doesn't throw the cell size off too much, and makes it easier to align the thumbnail with the title. Not sure if this can be done through CPMFetch, or if it would be a CSS thing.

ANy help would be appreciated. Thanks for creating this tool. It's great, especially since it's fairly easy for us newbies :).

Any chance someone knows about these 2 questions? The first one is more important to me than the second, but help on either would be greatly appreciated (or a push in the right direction for more info). Thanks.

Titan85

Quote from: LooneyToonDad on June 15, 2006, 04:00:32 PM
Any chance someone knows about these 2 questions? The first one is more important to me than the second, but help on either would be greatly appreciated (or a push in the right direction for more info). Thanks.
I think that this might help you: http://cpmfetch.fistfullofcode.com/php-lib/showexternal.php?url=http://www.fistfullofcode.com/projects/copperminefetch/manual/index.htmlNot sure if it answers your first question, but I think I saw something like that when I was going through there  :D.

Titan85

I am not sure if anyone saw my second question because it was kinda mixed up with my first one. But I do have one question un answered:
Quote from: Titan85 on June 15, 2006, 12:47:42 AM
I have what could be a stupid question...Is there a way to use cpmfetch more than once on a page? For example, if i wanted to display the latest images from on album in one section of the page and display the latest images from another album on a different area of the page?

LooneyToonDad

I had asked this earlier, but maybe I didn't state it properly. I've read the docs and found that the function cpm_setFilter($filter) is what I want to change in order to have CPMFetch show only photos on my website (not video or music). I found the function in the file cpmfetch_dao.php. Here's the code I'm looking at:

function setFilter($filterarray) {
if ($filterarray == "") {
$this->filetypefilter = "";
} else {
$this->filetypefilter = " and (";
foreach ($filterarray as $filter) {
$this->filetypefilter .= " p.filename like '%" . strtolower($filter) . "'";
$this->filetypefilter .= " or p.filename like '%" . strtoupper($filter) . "'";
$this->filetypefilter .= " or ";
}
$this->filetypefilter = substr($this->filetypefilter,0, strlen($this->filetypefilter) - 4);
$this->filetypefilter .= ') ';
}
}


Being new to php , I'm not sure in which line I define the variable/array to tell it which extensions I want it to show (I really only want .jpg's for now, but in the future I may add more to the array). If someone could point out which line(s) to change, it would be very appreciated, or if I'm way off base on this altogether, please let me know. Thank you.

alrs

I'm using Coppermine 1.4.8 and cpmfetch 1.6.2 to create this row of thumbnails:

http://photos.bikeboom.com/cpmtest/thumbnail_header.php

Sadly, pictures in the category that were uploaded by a guest user don't show up in the html generated by cpmfetch.



<?php
include "cpmfetch.php";
$options = array( 'imageheight' => '75' 'windowtarget' => '_top' );
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewLastAddedMediaFrom 18"cat=2"$options);
$objCpm->cpm_close();
?>



Sleuthing around, I think that the reason that cpmfetch doesn't include pictures uploaded by guest (even after approved by moderator) can be found in this line of code in cpmfetch_dao.php

$sqlcode = "SELECT " . $this->sqlPictureAlbumSelect . " FROM " . $this->sqlPictureSourceSelect . " where p.aid = a.aid AND p.owner_id = u.user_id" . $this->filetypefilter ." and p.approved='YES' "

By knocking out AND p.owner_id = u.user_id
I am able to get guest-uploaded pictures to show up, but they appear twice.  I'd like to see guest-uploaded photos (the bulk of the images on my site) get properly called by cpm_viewLastAddedMediaFrom.

Thanks.
Lars
http://bikeboom.com


jasa


First sorry to post this question on 3 places in CPG forum - Im new here and forum is big so it took time to figure out where and how to post...  ;)

Recently I installed CFGfetch 1.6.2 (CPG148) and everything works fine, but it shows only pictures from user galleries (uploadad through CPG)!
If I choose other public categories it shows no pictures!?
For example when I put for $source = "cat=1"; it works fine, when I put cat=2 or some other cat number which exist in my gallery, CPGfetch doesnt show anything!


My CPGfetch code on the main page is:
<?php
include "scripts/cpgfetch/cpmfetch.php";
$objCpm = new cpm('/galerija');
$options = array( 'imagestyle' => 'slika');
$source "";

$objCpm->cpm_viewLastAddedMediaFrom(31,$source,$options); 
$objCpm->cpm_viewRandomMediaFrom(1,1,$source,$options);

$objCpm->cpm_close(); ?>


I dont have any clue what is the problem...
Thanks for help...

Greetz
Jasa

PS. Does anybody know how to make CPGfetch to show random pictures from last added album?

jasa

Problem solved (now it works) I changed the source code slightly: :)
Database query was wrong because all pictures in public galleries have p.owner_id=0... :(
By random picture I put out p.owner_id = u.user_id and by getLastAddesMedia replaced throuh (p.owner_id = u.user_id OR p.owner_id = 0)...

Greetz
J.


jasa

In my previous post I wrote something about solution of the problem to show every picture in gallery instead only user galleries – somebody asked me to explain this in detail.

First of all I think that CFMfetch has problems with public galleries which are uploaded with FTP. Since such pictures doesn't have right picture owner – owner_id is 0 – all mysql queries doesn't bring any results!

I need 2 things - cpm_viewLastAddedMediaFrom(5, 1,$source) and cpm_viewRandomMediaFrom(3,1,$source,$options); so I changed this two function which are in cfmfetch_dao.php

In function getRandomImageFrom
In line 457 I deleted p.owner_id = u.user_id so I've now:

$sqlcode = "SELECT " . $this->sqlPictureAlbumSelect . " FROM " . $this->sqlPictureSourceSelect . " WHERE a.aid = p.aid AND p.approved='YES' "
. $this->filetypefilter . " " . $this->privacyfilter . $sourceSql
. " ORDER BY rand(" .  $this->getRandomSeed()   . ") LIMIT $count";


And function getLastAddedMediaFrom
Line 430 I removed whole part of SELECT with user queries (maybe it would work in first case too) because when you have p.owner_id = u.user_id  it shows only the same pictures. Now I have (I was lazy so I copied code directly from sqlPictureAlbumSelect and sqlPictureSourceSelect):

$sqlcode = "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 FROM cpg11d_pictures as p, cpg11d_albums as a where p.aid = a.aid" . $this->filetypefilter ." and p.approved='YES' "
. $sourceSql . " {$this->privacyfilter} "
. " ORDER BY p.ctime DESC LIMIT 0,$count";


Yeah – I agree this is absolutely bad coding but it works. I don't have time and knowledge of mysql and php to solve this right... I just played and figured how it works...

Maybe author will present some bugfix in future... :)

Greetz
J.

PS. Sorry because bad English...

davelu

I need a bit help here. How would retrive the source of an image to a var?

include ......
cmp...
$image = $objCpm->cpm_viewRandomMedia (1,6);

I hope you get what i mean. Thanks
-Dave

stuarta

Just reinstalled this on a new host to work on a test site.

My URL is http://saukairbrakes.awardspace.com and have installed Coppermine into a folder called gallery and cpmfetch into cpmfetch, both on the root.

If I configure cftest.php with '/gallery', I get the 'can't find CPG' in the error.  If I set in the full path of '/home/www/saukairbrakes.awardspace.com/gallery', it finds the CPG file but the test pictures can't be displayed and the URL shows as 'http://saukairbrakes.awardspace.com/home/www/saukairbrakes.awardspace.com/gallery/displayimage.php?pos=-3'; which I'm assuming looking at it that it's completely.

I've created a new PHP page with the following code block but just get errors coming back which can be viewed here http://saukairbrakes.awardspace.com/pictest.php

include "http://saukairbrakes.awardspace.com/cpmfetch/cpmfetch.php";
$objCpm = new cpm('/gallery');
$objCpm->cpm_viewRandomMedia (10,1);
$objCpm->cpm_close();


I hope someone can help me overcome these problems
Comptia A+ / Network + certified

jerx

I am trying to show the last added albums during the last 7 days on my homepage. I wanted to use cpm_showAlbumsUpdatedOverLastDays($numberOfDays,$options="") function, but it displays the last added albums sorted according to categories. My categories are sorted alphabetically and therefore the function cpm_showAlbumsUpdatedOverLastDays($numberOfDays,$options="") displays the last updated albums sorted by category.

Example:

category a: album a1, created on 2006/06/23, album id=1
                album a2, created on 2006/06/30, album id=4
category b: album b1, created on 2006/06/23, album id=2
                album b2, created on 2006/06/30, albunm id=5
category c: album c1, created on 2006/06/23, album id=3
                album c2, created on 2006/06/30, albunm id=6

Right now cpmfetch displays the following:
album a1 (06/23)
album a2 (06/30)
album b1 (06/23)
album b2 (06/30)
album c1 (06/23)
album c2 (06/30)
This is not cronological. It displays albums of the category, which is listed first, in ascending creation order. Then it does the same with the categories, which are listed second and third.

I want the albums to be displayed in descending creation order, no matter which category they belong to. So, it should be sorted in descending album id order. Here it would look like this:
album c2 (06/30), id=6
album b2 (06/30), id=5
album a2 (06/30), id=4
album c1 (06/23), id=3
album b1 (06/23), id=2
album a1 (06/23), id=1
Here the order is chronological and it is much easier to know, which albums have been added recently.

Is it possible to change the display order of the function? Or is there any other way to display the most recent album updates?

HoundSP

I'm having problem with CPM fetch after bridge with IPB 2.0.x.The imge display only shows the admin album.
Refer to this post : http://www.simplemachines.org/community/index.php?topic=73366.0

I've tried to change the table name to match with ipb table name but it still not working.

I've made changed on the following


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

To ipb user table

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

also change

Code:
u.user_lastvisit AS uUser_lastvisit
to

Code:
u.last_visit AS uUser_lastvisit
and all instances

Code:
u.user_id
to

Code:
u.id

stuarta

right think my problem is that I need to force the document root as it's coming back as /.

I've added $_REQUEST['DOCUMENT_ROOT'] = "/home/www/saukairbrakes.awardspace.com"; but still get no Document_root showing up.

I'm just trying this at the moment on the test file
Comptia A+ / Network + certified

Duerre76

Hello!

I am not customize to this forum, so i didn't find where to create new thread, but maybe this is not possible (i am french and doesn't understand everything in english)

Then, sorry if this question has already been asked but.. i have two different galleries installed on my website (the two are runned by coppermine) and i would like to know if this possible to display latest images update of both galleries on the main site. I tried several things but each time i receive this message "Cannot redeclare class cpm".

Thank you by advance  ;D

~Duerre~

Nibbler

Try like this:


<?php

include "path/to/cpmfetch.php";

$objCpm = new cpm('/gallery1');
// code here for gallery 1

$objCpm = new cpm('/gallery2');
// code here for gallery 2

?>



Duerre76

Quote from: Nibbler on July 08, 2006, 08:18:58 PM
Try like this:


<?php

include "path/to/cpmfetch.php";

$objCpm = new cpm('/gallery1');
// code here for gallery 1

$objCpm = new cpm('/gallery2');
// code here for gallery 2

?>



Thank you very much! It works  :-*

Ashari

Hi, I'm using Coppermine 1.4.8 and I am trying to use CPFetch to call images from all of my member's albums. they are not private, however when I use
print "<center>";
include "../cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewLastAddedMedia(5,1,array("imagesize" => "Thumb","windowtarget" => "_new","subtitle" => "Member: %o - %c "));
$objCpm->cpm_close();
print "</center>";

I ONLY get images from the album created by the admin. I have tried using "cat=1" but that creates an error. Do I need to change something in my dao.php file? I've been searching the board but can't find an answer. Can someone help me please?

stuarta

ok just moved my website to new host.

I've added the following code into a test page

include "http://simaviatorsuk.co.uk.streamlinenettrial.co.uk/cpmfetch/cpmfetch.php";
$objCpm = new cpm('http://simaviatorsuk.co.uk.streamlinenettrial.co.uk/cpg148');
$objCpm->cpm_viewRandomMedia (10,1);
$objCpm->cpm_close();


Host is http://simaviatorsuk.co.uk.streamlinenettrial.co.uk, cpmfetch is installed in /cpmfetch and gallery in /cpg148

When I access the page I get the following error

Fatal error: Cannot instantiate non-existent class: cpm in e:\domains\s\simaviatorsuk.co.uk.streamlinenettrial.co.uk\user\htdocs\pictest.php on line 13

Can anyone help please
Comptia A+ / Network + certified