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: How to display random picture instead of random thumb table ?  (Read 3977 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.018 seconds with 20 queries.