How to display random picture instead of random thumb table ? How to display random picture instead of random thumb table ?
 

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

Main Menu

How to display random picture instead of random thumb table ?

Started by Cilox, October 14, 2009, 04:55:29 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Cilox

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

phill104

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);
It is a mistake to think you can solve any major problems just with potatoes.

Cilox

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