how to limit cpm fetch to display only one file type? how to limit cpm fetch to display only one file type?
 

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

how to limit cpm fetch to display only one file type?

Started by capecodgal, July 09, 2007, 07:33:42 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

capecodgal

I use 2 installs of coppermine on a few of my sites... one for images and another for videos (I like to keep them seperate to have seperate layouts)

Anyways I am hoping this fabulous mod will allow me to limit the display to a certain file type?

With older mods when trying to do a latest videos on my main page I ran into an issue of receiving a red x on the zip files (happened because of the order the files were uploaded, simple fix was to allow upload the zips first and my jpg's last well that gets old after a while LOL)

So I am hoping there is a way to limit cpm fetch to a certain file type in the display?

I have been playing around with it on another site for now until I get the hang of this:

www.Hayden-Collective.net/header2.php

The last example labled Latest By Category is the cpm fetch (other 2 are not yet but will be soon =) )

The code I used in my page was:

<?php
  
include_once "/home/login/public_html/gallery/cpmfetch/cpmfetch.php";
  
$objCpm = new cpm ("/home/login/public_html/gallery/cpmfetch/cpmfetch_config.php");
  
$objCpm->cpm_showCategoriesUpdatedOverLastDays(7);
  
$objCpm->cpm_close();
?>


So using this as an example for testing purposes- say I only want to display a specific file type what options would I use? Lets say PNG files for this example (my normal would be JPG but I can alter that later)

I have not quite yet gotten the hang of the arrays which may be what I need to master first. I have tried using the documentation but even though it makes sense as I read I keep putting the code in the wrong place and getting parse errors. 

Would you kindly let me know what direction I would need to head in to accomplish the specific file type? I know once I get the arrays the rest will start making more sense.


vuud

Quote from: capecodgal on July 09, 2007, 07:33:42 PM
I use 2 installs of coppermine on a few of my sites... one for images and another for videos (I like to keep them seperate to have seperate layouts)

Anyways I am hoping this fabulous mod will allow me to limit the display to a certain file type?

With older mods when trying to do a latest videos on my main page I ran into an issue of receiving a red x on the zip files (happened because of the order the files were uploaded, simple fix was to allow upload the zips first and my jpg's last well that gets old after a while LOL)

So I am hoping there is a way to limit cpm fetch to a certain file type in the display?

I have been playing around with it on another site for now until I get the hang of this:

www.Hayden-Collective.net/header2.php

The last example labled Latest By Category is the cpm fetch (other 2 are not yet but will be soon =) )

The code I used in my page was:

<?php
  
include_once "/home/login/public_html/gallery/cpmfetch/cpmfetch.php";
  
$objCpm = new cpm ("/home/login/public_html/gallery/cpmfetch/cpmfetch_config.php");
  
$objCpm->cpm_showCategoriesUpdatedOverLastDays(7);
  
$objCpm->cpm_close();
?>


So using this as an example for testing purposes- say I only want to display a specific file type what options would I use? Lets say PNG files for this example (my normal would be JPG but I can alter that later)

I have not quite yet gotten the hang of the arrays which may be what I need to master first. I have tried using the documentation but even though it makes sense as I read I keep putting the code in the wrong place and getting parse errors. 

Would you kindly let me know what direction I would need to head in to accomplish the specific file type? I know once I get the arrays the rest will start making more sense.



Look at cpm_setFilter in the doc's for cpmfetch_dao

It does what you want.  You would insert it in after your "new" line and before you call for any images.



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

capecodgal


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

yazeft

i've got this and it doesnt work, i get a parse error:

<?php
include "./gallery/cpmfetch/cpmfetch.php";
$objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
void   cpm_setFilter  ([mixed $filter ".jpg",".bmp"])
$objCpm->cpm_viewRandomMedia(1,5, array('alttag' => '%t'));
$objCpm->cpm_close();
?>


All i want is picture files to SHOW - i don't want videos, etc to show.. what am i doing wrong?

yazeft

Sorry, this is the code i'm using and i still get the flv files displayed:


<?php
include "./gallery/cpmfetch/cpmfetch.php";
$objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_setFilter(array(".jpg"));
$objCpm->cpm_viewRandomMedia(1,5, array('alttag' => '%t'));
$objCpm->cpm_close();
?>

vuud

Quote from: yazeft on July 21, 2007, 07:27:21 AM
Sorry, this is the code i'm using and i still get the flv files displayed:


<?php
include "./gallery/cpmfetch/cpmfetch.php";
$objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_setFilter(array(".jpg"));
$objCpm->cpm_viewRandomMedia(1,5, array('alttag' => '%t'));
$objCpm->cpm_close();
?>


What version of cpmfetch are you using?  ("latest" is not a valid answer)
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

yazeft


yazeft

 :'( it's still not working.. please please please, what's the correct way to do the filter?

Joachim Müller


yazeft

Quote from: GauGau on July 25, 2007, 08:06:42 AM
This is not a hotline! Allow days for answers! See FAQ: I've posted my question a while ago, but nobody answers. What the...?

sorry for my impatience and ignorance to the FAQs prior to posting..

have I provided enough info?

all I need is the correct method of placing the 'filter' code using cpgfetch 2.0.0 to only display pics. thanks


Joachim Müller

Is this suppossed to be a speed-posting contest ::)?

capecodgal

I still have not quite gotten this to work... I edited the cpmfetch_dao.php at line 164 as the documentation states which was

function cpm_setFilter($filter=".jpg")

I added the .jpg in there and it still doesn't work, in fact I can't get it to call from the second install at all.

I have coppermine installed in /photos and /videos directories the /photos works great but the /photos works on the install but not when I include on my php page. I tried changing the name of the config file just incase that could be an issue and that did not do it, also I tried the absolute path and that did not do it either.

Not trying to ask support on a second issue but could the problem be running 2 galleries off the same sql user? I am just trying to make sure what I edited in the cpmfetch_dao.php was correct

capecodgal

Just some further information for Vudd,

I reran the install page just incase I had messed up somewhere and it displayed the items correctly and I did only get the .jpg so I think that part is working from the 4 examples I saw.

I'll start a new thread since my other issue is not related, as far as I can tell the original question is solved thanks for the direction sometimes thats all I need

And BTW, I LOVE this mod. Major Kudos to you for creating this, it is so going on all my sites after I get this one sorted out and I'll definately link you somewhere in my credits