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: SIngle random intermediate image in index page  (Read 3486 times)

0 Members and 1 Guest are viewing this topic.

Paul E

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
SIngle random intermediate image in index page
« on: October 27, 2006, 04:44:21 pm »

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
Logged

Gizmo

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1015
    • BullsEye Photos
Re: SIngle random intermediate image in index page
« Reply #1 on: October 28, 2006, 06:38:52 pm »

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.

Code: [Select]
<?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.
Logged
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

  • Coppermine newbie
  • Offline Offline
  • Posts: 4
Re: SIngle random intermediate image in index page
« Reply #2 on: October 28, 2006, 08:13:07 pm »

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
Logged

Gizmo

  • Dev Team member
  • Coppermine addict
  • ****
  • Offline Offline
  • Gender: Male
  • Posts: 1015
    • BullsEye Photos
Re: SIngle random intermediate image in index page
« Reply #3 on: October 29, 2006, 05:06:37 pm »

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.
Logged
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
Pages: [1]   Go Up
 

Page created in 0.02 seconds with 20 queries.