i want show Random pic on my main home page i want show Random pic on my main home 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

i want show Random pic on my main home page

Started by ahsanch, February 05, 2008, 08:53:55 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

ahsanch

Hi sir

  i want to show Random Pic on my home page plz gide me

thx

Regard
Ahsan Ch (PAK)

Joachim Müller

Not related to install - moving.
If you mean a non-coppermine-driven page where you want to disply content taken from coppermine, then take a look at the mod board "content syndication". The coppermine dev team recommends using cpmFetch.

ahsanch

hi sir  Good morning
    sir i can not understand what you say sir plz tell me in detail i m very thanks ful to you.

thx
Regard
Ahsan CH (PAK)

Joachim Müller

Link to the sub-board "content syndication": http://forum.coppermine-gallery.net/index.php?board=57.0
Link to the announcement thread for cpmFetch: http://forum.coppermine-gallery.net/index.php?topic=35231.0

If this is a language issue, ask a friend to translate this for you.

nish

hi...
     use CPMFetch download if from http://cpmfetch.fistfullofcode.com/ and just upload it to your gellery folder use
     http://yourdomain.com/path_to_gallery/install.php
     to install and use

  <?php
  
include "./cpmfetch.php";
  
$objCpm = new cpm("./cpmfetch_config.php");
  
$objCpm->cpm_viewRandomAddedMediaFrom(1,4);
  
$objCpm->cpm_close();
   
?>



code
Thanks
Nish

Joachim Müller

That set of instructions is too simple. I posted the links to the relevant thread / board. ahsanch needs to read up the docs.

ib2loud

Very cool feature, with a little trial and error I managed to get it working easily and that's saying something for me!

JohnM-UK

Hi. Someone showed me how to do this without using any add-ons. I am currently using it in the 'welcome' section at the top of my gallery page: http://www.oneuk.f2s.com/photos/
Here is the code: (Let's say for this example you are using a file called 'anycontent2.php') (sorry if it's a bit long winded!)
1. Create a folder anywhere on your webserver where you will put your random images, and upload the images you want to use
2. Make a copy of the file 'anycontent.php' and rename it to anycontent2.php
3. Add the following code to this file:

<?php

$banners 
= array(=> 'rand1.jpg'=> 'rand2.jpg'=> 'rand3.jpg'=> 'rand4.jpg');

$random rand(1,4); 

$banner "http://www.oneuk.f2s.com/images/rand/" $banners[$random];

echo 
"<p style='text-align: left'><img border=6 src='" $banner "' alt='' /></p>";

?>


Below is a description of the code:

<?php

$banners 
= array(=> 'rand1.jpg'=> 'rand2.jpg'=> 'rand3.jpg'=> 'rand4.jpg'); // this is a list all of the image numbers that you will be using and their filenames

$random rand(1,4);  // this is which of the above image numbers you want to use (in this case all of them) so if you have 4 images as I have here you use "(1,4)" if you have 5 images use "(1,5)" for 10 use "(1,10)" etc etc

$banner "http://www.oneuk.f2s.com/images/rand/" $banners[$random]; // this is the folder where your images are located. Change for your server details obviously.

echo "<p style='text-align: left'><img border=6 src='" $banner "' alt='' /></p>";

?>


Now open 'index.php' and find the following code:

case 'anycontent':
                        if ($cat == 0) {
                            ob_start();
                            /**
                             * Any php code or HTML can be put in this file and will be displayed
                             */
                            include('anycontent.php');
                            $anycontent = CPGPluginAPI::filter('anycontent',ob_get_contents());
                            ob_end_clean();
                            echo ($anycontent);
                        }
                        flush();
                        break;

and add below it: (basically change all instances of 'anycontent')
case 'anycontent2':
                        if ($cat == 0) {
                            ob_start();
                            /**
                             * Any php code or HTML can be put in this file and will be displayed
                             */
                            include('anycontent2.php');
                            $anycontent2 = CPGPluginAPI::filter('anycontent2',ob_get_contents());
                            ob_end_clean();
                            echo ($anycontent2);
                        }
                        flush();
                        break;



That's it, it works for me!
See my gallery: http://www.oneuk.f2s.com/photos/
Refresh the page and the images at the top left of the page will change


ib2loud

that's not a bad idea either, but i don't want to re-upload all 7000 images i have in my gallery into another folder

good for those who want a small bit of random images though!