SIngle random intermediate image in index page SIngle random intermediate image in index page
 

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]

Main Menu

SIngle random intermediate image in index page

Started by Paul E, October 27, 2006, 04:44:21 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Paul E

Hi all.

I navigated the forum but didn't see replies to my question. If it exists indeed or if this is not the right place to ask it, please let me know.

So here is my question:
how could I modificate the index page so it displays a single image, size intemediate , and taken from any of the /categories/albums from the site ?

I checked the config/album list view/The content of the main page option, but it doesn't seem to offer this option (or I didn't get it)

Anybody has an idea of how to do that? Is this option already built in, or should I use some external code (and which) ?

Thanks in advance for your answers,

Regards,
Paul

Gizmo

This can be done with cpmFetch and using the anycontent.php file. cpmFetch is realy cool and allows you to access images in your Coppermine gallery from other websites such as blogs but even from Coppermine itself. I'll outline the steps here to get it setup and if you need more help, come back.

Step 1. Download and install cmFetch according to the instructions here - http://forum.coppermine-gallery.net/index.php?topic=35450.0. If you have problems getting it installed, please ask for help on the cpmFetch board and not here. Don't worry, it's very easy to install but again, ask for installation help on the cpmFetch board. (Notice how I mentioned that twice.  ;)) I also suggest you visit vuud's site for a complete explanation of cpmFetch.

Step 2. Add the anycontent.php to your main page layout by following these instructions - http://coppermine-gallery.net/demo/cpg14x/docs/index.htm#admin_album_list.

Step 3. The default anycontent.php file is located in your Coppermine root direction. Here is an example of how you will set it up. NOTICE: you have to add your cpmFetch installation path to this file in 2 places. This setup is for a single intermediate image to be displayed from album #7. You can also make this a random image from any category or the whole gallery. Upload to your Coppermine root directory.

<?php
/*************************
  Coppermine Photo Gallery
  ************************
  Copyright (c) 2003-2006 Coppermine Dev Team
  v1.1 originally written by Gregory DEMAR

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation; either version 2 of the License, or
  (at your option) any later version.
  ********************************************
  Coppermine version: 1.4.9
  $Source$
  $Revision: 3125 $
  $Author: gaugau $
  $Date: 2006-06-16 08:48:03 +0200 (Fr, 16 Jun 2006) $
**********************************************/

/**
* Coppermine Photo Gallery 1.4.9 anycontent.php
*
* This file file gets included in the index.php if you set the option in admin
* can be used to display any content from any program, it is always to be edited
* according to tastes and then used
*
* @copyright 2002,2005 Gregory DEMAR, Coppermine Dev Team
* @license http://opensource.org/licenses/gpl-license.php GNU General Public License V2
* @package Coppermine
* @version $Id: anycontent.php 3125 2006-06-16 06:48:03Z gaugau $
*/

if (!defined('IN_COPPERMINE')) die('Not in Coppermine...');

starttable("100%""Random Image");

?>

<tr><td class="tableb" >
<?php
       include "../your_cpmFetch_root_dir/cpmfetch/cpmfetch.php";
       $objCpm = new cpm("/your_cpmFetch_root_dir/");
       $options = array( 'imagesize' => 'int' );
       $objCpm->cpm_viewRandomMediaFromAlbum(1,1,7,$options); 
       $objCpm->cpm_close();
       ?>

</td></tr>
<?php
endtable
();

?>



This should do it. I hope you find this useful.
Did you read the manual first???? Taking 2 minutes to backup your files can save you hours of wondering what you screwed up.
Billy Bullock - BullsEyePhotos Blog of Indecision

Paul E

Thanks a lot Gizmo.

Has it is not such a straight process, I'll study it a bit and let you know.

Thanks again,
regards,
Paul

Gizmo

There are other ways but they all involve some coding changes and some more invoved than others. I think this method is the best and you get other benefits from it with cpmFetch. Take it step by step and you'll be ready to go in no time.
Did you read the manual first???? Taking 2 minutes to backup your files can save you hours of wondering what you screwed up.
Billy Bullock - BullsEyePhotos Blog of Indecision