forum.coppermine-gallery.net

Support => cpg1.4.x Support => Older/other versions => cpg1.4 cpmFetch by vuud => Topic started by: Cilox on October 14, 2009, 04:55:29 pm

Title: How to display random picture instead of random thumb table ?
Post by: Cilox on October 14, 2009, 04:55:29 pm
Hello All,

  I spent some time a while ago setting up some CPG scripts from php as well as inside a WordPress blog. All works fine ! Awesome plugin !!!
  Now, i woiuld like to show a random image taken from an album on the main page of my website.

  I already made it, but for a specific picture. I would like to turn this random ...

<?
$objCpm = new cpm(".../www/photos/cpmfetch/cpmfetch_config.php");
$options = array('windowtarget' => '_blank',"imagesize"=>"large","imagewidth"=>"640","imagelink"=>"album","subtitle" => "<center>{{pTitle}} by {{pOwner_name}} (click to enter photogallery)</center>");
$objCpm->cpm_viewMediaByPid (1186, $options);
$objCpm->cpm_close();
?>

  To be honest, i feel i am missing something in my search, and cannot remember how to proceed ...

  So, all clues will be very welcomed ! Thanks ! ;)

CiloX
Title: Re: How to display random picture instead of random thumb table ?
Post by: phill104 on October 14, 2009, 05:26:26 pm
Please always post a link to your gallery.

Have you looked at the manual?

http://cpmfetch.fistfullofcode.com/docs/index.php

In there it explains how to use the following.

$objCpm->viewRandomMediaFrom("",1,1,$options);
Title: Re: How to display random picture instead of random thumb table ?
Post by: Cilox on October 14, 2009, 06:55:38 pm
Well, difficult to post a link because i am precisely working on modifying this main page. This will be hopefully soon be online at http://www.florennes-as.be/

I looked at the manual, but was not able to remember i had to change the $options table to let it work.
So, many thanks for the clue about the right function call (i used in a wrong way) !!!

The code is now ...

<table width="800" border="0" align="center">
  <tr><td> 
  <?php
    include "./engine/cpmfetch/cpmfetch.php";
    $objCpm = new cpm("./engine/cpmfetch/cpmfetch_config.php");
    $options = array('windowtarget' => '_blank',"imagesize"=>"large","imagewidth"=>"800","imagelink"=>"album","subtitle" => "<center>{{pTitle}} by {{pOwner_name}} (click to enter photogallery)</center>");
   $objCpm->cpm_ViewRandomMediaFrom("album=111",1,1,$options);
    $objCpm->cpm_close();
  ?>
  </td></tr>
</table>

CiloX