Advanced search  

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Pages: [1]   Go Down

Author Topic: How to display random picture instead of random thumb table ?  (Read 3975 times)

0 Members and 1 Guest are viewing this topic.

Cilox

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
How to display random picture instead of random thumb table ?
« 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
Logged

phill104

  • Administrator
  • Coppermine addict
  • *****
  • Country: gb
  • Offline Offline
  • Gender: Male
  • Posts: 4885
    • Windsurf.me
Re: How to display random picture instead of random thumb table ?
« Reply #1 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);
Logged
It is a mistake to think you can solve any major problems just with potatoes.

Cilox

  • Coppermine newbie
  • Offline Offline
  • Posts: 7
Re: How to display random picture instead of random thumb table ?
« Reply #2 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
Logged
Pages: [1]   Go Up
 

Page created in 0.014 seconds with 19 queries.