coppermine-gallery.com/forum

Support => cpg1.4.x Support => Older/other versions => cpg1.4 cpmFetch by vuud => Topic started by: dwo on June 25, 2008, 09:41:38 PM

Title: Fetch from category or album
Post by: dwo on June 25, 2008, 09:41:38 PM
Hello.

I really had a long time to figure this out. Mainly due to wrong description in the cpmfetch docs.
If you want to fetch from a album or category, you need to add "From"

$objCpm->cpm_viewLastAddedMediaFrom("cat=4", 2, 2, $options);  

Second, you need to write cat=4 or album=5 in " " Not in ?? like described in the docs.

reagrds, Dietmar
Title: Re: Fetch from category or album
Post by: dwo on June 25, 2008, 09:42:31 PM
Sorry. did not knew that bold doesnt work in code, could you fix this please. thanks.
Title: Re: Fetch from category or album
Post by: just_some_guy on June 25, 2008, 10:23:08 PM
Done.
Title: Re: Fetch from category or album
Post by: fangweile on June 26, 2008, 01:30:21 PM
I used this code to fetch images from certain album:

//cpmfetch code
echo "<CENTER>";
  include_once "./gallery/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewRandomMediaFrom("album=55",2,6);
$objCpm->cpm_close();
echo "</CENTER>";


where 55 is album ID
2 no of rows of images to displays
6 no of columns of images to displays


For categories:

//cpmfetch code
echo "<CENTER>";
  include "./gallery/cpmfetch/cpmfetch.php";
  $objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");

  $objCpm-> cpm_viewRandomMediaFromCategory ( 1, 5, 3);
  $objCpm->cpm_close();
echo '</center>';


Where 1 is the category id.

;)
Title: Re: Fetch from category or album
Post by: mauba on June 26, 2008, 02:13:53 PM
How can I do to display a pic from the three first album with their names above them.

The album must displayed in the horizotal position.
Title: Re: Fetch from category or album
Post by: dwo on June 26, 2008, 03:27:06 PM
Oh thanks fangweile, I thought random from category does not work. Very good!
Title: Re: Fetch from category or album
Post by: dwo on June 26, 2008, 03:34:07 PM
Sorry, I use 2.0.0 and there this code works:

$objCpm-> cpm_viewRandomMediaFrom ("cat=4", 1, 2, $options);