Display a random image on an external website. - Page 3 Display a random image on an external website. - Page 3
 

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

Display a random image on an external website.

Started by djib, January 15, 2006, 01:30:56 PM

Previous topic - Next topic

0 Members and 3 Guests are viewing this topic.

wfs

Hi, appreciate it if any body can help.
I don't know enough of PHP to amend the code by djib.

I just want to get one random image from a particular album.

thanks.


Pascal YAP

Morming,

@Tommytomato :
QuoteAll i'm geting is a blank page, any idea on why its not working ?

Yes  ;D
You do not setup your CpmFetch's config correctly  ???


PYAP

DevilBrain

Hi
I have my site in root folder but copermine is installed in a "wallpapers" named folder which is located is root, plz tell me how can i get random wallpapers from my wallpapers gallery folder to show on root index file ?

I am not familiar with php, plz tell me what should i have to do with code that you give in quote and where to put include tag ?

Please help me i will be very thankfull.

DevilBrain

Quote from: DevilBrain on November 01, 2006, 04:13:03 PM
Hi
I have my site in root folder but copermine is installed in a "wallpapers" named folder which is located is root, plz tell me how can i get random wallpapers from my wallpapers gallery folder to show on root index file ?

I am not familiar with php, plz tell me what should i have to do with code that you give in quote and where to put include tag ?

Please help me i will be very thankfull.

Anyone here to please help me ?

debragrant

Quote from: djib on January 15, 2006, 04:03:39 PM
I found a solution.
<?php 
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery - random photo displayer                         //
// ------------------------------------------------------------------------- //
// Based on Dr. Tarique Sani RSS feed for Coppermine                         //
// http://tariquesani.net/                                                  //
//
// Adapted by djib to display a random photo - http://djib.biz              //
// 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.                                      //
// ------------------------------------------------------------------------- //
// Just put into the same directory as your coppermine installation         //
// ------------------------------------------------------------------------ //

define('IN_COPPERMINE'true);
define('INDEX_PHP'true);
require(
'include/init.inc.php');

//How many items you want to show
$thumb_per_page 1;

$thumb_count 4;
$lower_limit 0;


$album 'random';


//Changes these to point to your site if the following is not giving correct results.
$link_url $CONFIG['ecards_more_pic_target']."displayimage.php?pos=-";
$image_url $CONFIG['ecards_more_pic_target']."albums/";


$data get_pic_data($album$thumb_count$album_name$lower_limit$thumb_per_page);


foreach(
$data AS $picture) {

    
$thumb_url "$image_url$picture[filepath]$CONFIG[thumb_pfx]$picture[filename]";
    
$keywords explode(" ",trim($picture[keywords]));
    
$category_string "";
    
$pubDate gmdate("D, d M Y H:i:s"$picture[ctime]);
    
$description '<a href="' $link_url $picture['pid'] . '"><img src="' $thumb_url '"  alt="Random image"/></a>'.bb_decode($picture[caption]).bb_decode($picture[caption_text]);    
    echo 
$description;
}

?>



After that, just add <?php include(http://yoursite/get_photo.php); ?> where you want to display the photo.



I would make a .php file with the first code right where does it need to be placed? in the root?
The second code I add to the area I want the images displayed right?

Is it posisble to have moving images like this site -

http://penelopecruz.com/

my main site is in the root then coppermine in is the gallery folder.

DevilBrain

How to make thumbnail size bigger and get ride of views count.
Infact i need a clear one image thumbnail withou views.

I think no one here help others, as no one reply for my last post, however i am putting this post in just a hope.

pcotter

#46
A beautiful script!!! Thanks!
Dum Spiro, Spero
http://foto.pcotter.com

celeritycat

Ok I created a php file called it get_photo.php uploaded it to my coppermine folder which is pixleparty. This is what is in the php file.
<?php 
// ------------------------------------------------------------------------- //
// Coppermine Photo Gallery - RSS Feed                                      //
// ------------------------------------------------------------------------- //
// Copyright (C) Dr. Tarique Sani                                           //
// http://tariquesani.net/                                                  //
// Adapted by djib to display a random photo - http://djib.biz              //
// 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.                                      //
// ------------------------------------------------------------------------- //
// Just put into the same directory as your coppermine installation         //
// ------------------------------------------------------------------------ //

define('IN_COPPERMINE'true);
define('INDEX_PHP'true);
require(
'include/init.inc.php');

//How many items you want to show in your get_photo script
if(isset($_GET['nb'])) {
     
$thumb_per_page=$_GET['nb'];
} else {
     
$thumb_per_page 1;
}
$thumb_count 1;
$lower_limit 1;

if(isset(
$_GET['album'])){
    
$album $_GET['album'];
}

//If it is a numeric album get the name and set variables
if ((is_numeric($album))){
     
$album_name_keyword get_album_name($album);
     
$CURRENT_CAT_NAME $album_name_keyword['title'];
     
$ALBUM_SET "AND aid IN (".(int)$_GET['album'].")".$ALBUM_SET;
     
//Set the album to last uploaded
     
$album 'lastup';
}

//If the album is not set set it to lastup - this is the default
if(!isset($album)){
     
$album 'lastup';
}


//Changes these to point to your site if the following is not giving correct results.
$link_url $CONFIG['ecards_more_pic_target']."displayimage.php?pos=-";
$image_url $CONFIG['ecards_more_pic_target']."albums/";



$data get_pic_data($album$thumb_count$album_name$lower_limit$thumb_per_page);


foreach(
$data AS $picture) {
    
$thumb_url "$image_url$picture[filepath]$CONFIG[thumb_pfx]$picture[filename]";
    
$description '<a href="' $link_url $picture['pid'] . '"><img src="' $thumb_url '"  border="0" alt=" Galleria Latest"/></a>';
    echo 
$description;

}
?>



after that I put this where I wanted the image to show up.
<?php include("http://mysite.com/pixelparty/get_photo.php"); ?>

A picture place holder shows up, but no image and when you click on it, I get this page can not be found. I am using this on my index with express engine and I have set permissions to use php in my pages. Also I am using the latest version (1.4.10) of Coppemine and The user pictures are in /albums/userpics/.
So any help or suggestion would be aprreciated very much.

pcotter

Well after a few tests i changed my mind! Is not so beautiful.... :)
You can c it in action integrated with Joomla. http://joomla.pcotter.com , but as Gaugau said, the script will bypass Coppermine permissions, and display random thumbs from private albums.

Anyway, due to my server settings and early stage of joomla implementation, i will keep this script for a couple days till i get my hands in cpmfetch
Dum Spiro, Spero
http://foto.pcotter.com

DevilBrain

Hey dear i am satisfied with this script, plz just tell me how to control image size and how to remove views text.

toy2666

I like this script!!!

it is possible to have 4 rows with 5 thumbs on each?

I want to put the thumbs on a table with 600 width like this website: http://www.trekearth.com/gallery/

sorry for my english...  :(

est-ce possible d'avoir 4 rangé de 5 images au lieu d'avoir tout cela sur la meme ligne?
Je veux créer un tableau de 600 pixel de large qui serait centré sur ma page avec mes images qui serait justifié (et non collé) sur chaque ligne.
Voici un exemple qui ressemble un peu a ce que je veux: http://www.trekearth.com/gallery/

merci a tous

Pascal YAP

Quotesorry for my english...
Your english is perfect  ;D
But if mine is poor you can visit us in our French Coppermine Board (started in 2004)

Quoteit is possible to have 4 rows with 5 thumbs on each?
Yes. Perhaps you can change some settings in the begining of this script.

In my opinion try CpmFetch for security reason instead this script (sorry celeritycat  ;) )

PYAP

toy2666

I know Cpmfetch but it seem very difficult to use to display picture on another website.

What is the security problem of this script?

If the problem is because he display random thumbs from private albums, it's not a problem for me because i don't have private album on my gallery, only public.

Pascal YAP

#53
QuoteI know Cpmfetch but it seem very difficult to use to display picture on another website.
No it's very simple !
But, be sure to correctly set CpmFetch with correct paths.

I use CpmFetch on my personnal Gallery here (refresh screen every 10s) :
www.pays-dignois.com/galerie
and if you will visit my Gallery, i use also CpmFetch inside a FLASH animation (direct link)

CpmFetch, is a very usefull script.


PYAP

SolidSnake2003

Is there a way using this script for me to display pics from a certain gallery for one page on my site, then on another page display a pic from different galleries instead of just randomly picking images?

Joachim Müller

This very thread you're posting on does not deal with cpmFetch, but another unsupported little mod - the one explained on the very first posting of this thread. There is no support for cpmFetch on this very thread, but there is a whole sub-board dedicated to cpmFetch support.

@Supporters: please do not promote cpmFetch on this thread without making it totally clear that this thread is not meant for discussions on cpmFetch.

@people looking for support: please help us maintaining the board helpful - avoid thread-drift and cross-postings.

SolidSnake2003

Im not wanting support for cpmFetch, I was wanting support on the script that was presented here that isnt cpmfetch.

Joachim Müller

Basically, the mod presented on this board comes as is (without support). Sorry.

TecShdw

This is GREAT!  I've been trying to do it for some time myself with no success.  HA HA also, it took me a while to realize why it wasn't working right for me, I had to re-name my index.html to index.php (just in case anyone else has that issue) which is no issue, my old site was all php anyhow.

Thanks everyone!  I had to register just so I could express my appreciation (plus there is alot of other great info on the site)  If you want to see how I used it check out www.themotens.com I'm still going to sit down when I have more time and work on making the thumb image a bit larger so it fits my little window I have it in!

doctoreast

Tec,
  Just use coppermine's settings and admin tools to resize your thumbs.
All you do is set the size to 125 or 150 and run the wizard across all images.
pe