Advanced search  

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

Pages: [1]   Go Down

Author Topic: Fetch from category or album  (Read 5872 times)

0 Members and 1 Guest are viewing this topic.

dwo

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 143
Fetch from category or album
« 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"

Code: [Select]
$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
« Last Edit: June 25, 2008, 10:23:02 pm by just_some_guy »
Logged

dwo

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 143
Re: Fetch from category or album
« Reply #1 on: June 25, 2008, 09:42:31 pm »

Sorry. did not knew that bold doesnt work in code, could you fix this please. thanks.
Logged

just_some_guy

  • Supporter
  • Coppermine addict
  • ****
  • Offline Offline
  • Posts: 539
  • I am currently on holiday, back in a few weeks. :D
Re: Fetch from category or album
« Reply #2 on: June 25, 2008, 10:23:08 pm »

Done.
Logged
Tambien, Hablo Espaņol      PHP - Achieve Anything
"The Internet is becoming the town square for the global village of tomorrow. " - Bill Gates
Windows 7 Forums

fangweile

  • Coppermine frequent poster
  • ***
  • Country: 00
  • Offline Offline
  • Posts: 103
  • Saranghaeyo ^_^
    • All Koreans - Home of Korean Actors and Actresses
Re: Fetch from category or album
« Reply #3 on: June 26, 2008, 01:30:21 pm »

I used this code to fetch images from certain album:

Code: [Select]
//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:

Code: [Select]
//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.

 ;)
Logged
[My Coppermine Galleries]
All Koreans, Lim Eun-kyeong's IFC
Saranghae 김태희

mauba

  • Coppermine newbie
  • Offline Offline
  • Posts: 15
Re: Fetch from category or album
« Reply #4 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.
Logged

dwo

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 143
Re: Fetch from category or album
« Reply #5 on: June 26, 2008, 03:27:06 pm »

Oh thanks fangweile, I thought random from category does not work. Very good!
Logged

dwo

  • Coppermine frequent poster
  • ***
  • Offline Offline
  • Posts: 143
Re: Fetch from category or album
« Reply #6 on: June 26, 2008, 03:34:07 pm »

Sorry, I use 2.0.0 and there this code works:

Code: [Select]
$objCpm-> cpm_viewRandomMediaFrom ("cat=4", 1, 2, $options);
Logged
Pages: [1]   Go Up
 

Page created in 0.021 seconds with 19 queries.