coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 cpmFetch by vuud => Topic started by: capecodgal on July 09, 2007, 07:33:42 PM

Title: how to limit cpm fetch to display only one file type?
Post by: 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.

Title: Re: how to limit cpm fetch to display only one file type?
Post by: vuud on July 09, 2007, 10:55:22 PM
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.



Title: Re: how to limit cpm fetch to display only one file type?
Post by: capecodgal on July 09, 2007, 11:15:52 PM
ahhh Thank yous  ;D
Title: Re: how to limit cpm fetch to display only one file type?
Post by: vuud on July 10, 2007, 06:12:58 AM
Quote from: capecodgal on July 09, 2007, 11:15:52 PM
ahhh Thank yous  ;D

Your welcome
Title: Re: how to limit cpm fetch to display only one file type?
Post by: yazeft on July 21, 2007, 07:11:09 AM
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?
Title: Re: how to limit cpm fetch to display only one file type?
Post by: 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();
?>
Title: Re: how to limit cpm fetch to display only one file type?
Post by: vuud on July 21, 2007, 05:11:07 PM
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)
Title: Re: how to limit cpm fetch to display only one file type?
Post by: yazeft on July 21, 2007, 07:13:41 PM
copperminefetch-2.0.0
Title: Re: how to limit cpm fetch to display only one file type?
Post by: yazeft on July 23, 2007, 01:54:29 PM
 :'( it's still not working.. please please please, what's the correct way to do the filter?
Title: Re: how to limit cpm fetch to display only one file type?
Post by: Joachim Müller 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...? (http://coppermine-gallery.net/demo/cpg14x/docs/faq.htm#lamesupport)
Title: Re: how to limit cpm fetch to display only one file type?
Post by: yazeft on July 25, 2007, 09:28:17 AM
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...? (http://coppermine-gallery.net/demo/cpg14x/docs/faq.htm#lamesupport)

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
Title: Re: how to limit cpm fetch to display only one file type?
Post by: yazeft on July 25, 2007, 09:29:00 AM
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...? (http://coppermine-gallery.net/demo/cpg14x/docs/faq.htm#lamesupport)
Title: Re: how to limit cpm fetch to display only one file type?
Post by: Joachim Müller on July 25, 2007, 09:49:51 AM
Is this suppossed to be a speed-posting contest ::)?
Title: Re: how to limit cpm fetch to display only one file type?
Post by: capecodgal on August 13, 2007, 11:08:08 PM
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
Title: Re: how to limit cpm fetch to display only one file type?
Post by: capecodgal on August 14, 2007, 05:16:41 PM
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