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

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 2 Guests are viewing this topic.

chanfuterboy

about Thanks you! and to have latest pictures change random' to 'lastup'

     $album = 'lastup'; (like this)

if i want to show the last 4 albums in a 4 row of picture
$thumb_per_page = 4;

what should the $album = must become to display one of all 4 picture of last album?

troykristoffer

I absolutely love this easy script! Thanks!! I'm using it on my P!nk fansite, PinkJams.com . (No heckling please! hehe)

I have 2 installations of CPG installed, one for video and one for pics. The pic's one is working good (See the front page of www.pinkjams.com) but the video gallery instance of the script is returning "Photo al?atoire" instead of the video's related thumbnail. If you click the words, it does take you directly to the video file as designed, but I was hoping to do one of the following:

1. Display the thumbnail of the video or,
2. Display the file's "Title" that is settable in the 'edit file' interface of CPG.

Any suggestions? I realize this isnt the intended design of your script (displaying vids) but just thought I'd ask. Thanks!

Troy

Joachim Müller

Quote from: GauGau on March 21, 2006, 05:24:47 PM
This script is a nice little contribution, however it has severe drawbacks as far as I can see:
  • Permissions aren't being taken into account
  • Will only work for images, but not for other file types
  • Will only work if in the coppermine root folder

If you can live with those drawbacks, then fine. However, we don't recommend it - we recommend cpmFetch instead.

mona87

Quote from: truth005 on May 23, 2006, 10:01:08 PM

How do i change the border color of it?  I tried it with my style sheet but its not turning out right.  what do i put in that line in the get_photo.php file.

Thanks in advance

gothmandave

Thanks for sharing your code :-) It is working fine from within the copermine directory. Does anyone know how to make it work for a page outside coppermine?

toykilla

How do I use this script to pull from 1 album?

i see this

get_photo?album=6&nb=4

but dont know where to put it?

wfs

Hi,

thanks djib - great piece of code.

Just a question :

How do you get rid of the blue border round the pics?

Appreciate any help.

thank you.




wfs

so sorry, 
found the answer in an earlier posting.


wfs

Hi again,

Just wondering - anybody know how to put some space to separate each image ?

appreciate any help.

thanks.

yacenty

I would like to show 3 top rated and 3 most view pictures on my main page - is it possible to do it with this nice script?

best regards,
Yacenty

ashleyXcore

Quote from: wfs on August 02, 2006, 04:58:30 AM
Hi,

thanks djib - great piece of code.

Just a question :

How do you get rid of the blue border round the pics?

Appreciate any help.

thank you.

Where did you find the answer? I looked at this page:
http://cpmfetch.fistfullofcode.com/projects/copperminefetch/tips.php#cssboxes
But it doesn't even tell you where to put that code in order to style it...
"There are many kinds of eyes. Even the sphinx has eyes — and consequently there are many kinds of 'truths', and consequently there is no truth."

Nibbler

You put it in the styesheet of the page you are usng cpmfetch on. If it doesn't use a stylesheet then add it inline using <style> tags.

Joachim Müller

This thread doesn't deal with cpmFetch. Don't reply with question related to cpmFetch to this thread. In fact, there's a new support board dedicated to cpmFetch issues: cpg1.4 cpmFetch by vuud

ashleyXcore

Quote from: Nibbler on August 25, 2006, 08:46:07 PM
You put it in the styesheet of the page you are usng cpmfetch on. If it doesn't use a stylesheet then add it inline using <style> tags.

You would put this:
cpm_viewRandomMediaFromAlbum(2,2,17,array("tablestyle" => "test1","imagestyle" => "test1"));
in a stylesheet?

Sorry to post again in this thread by the way :/
"There are many kinds of eyes. Even the sphinx has eyes — and consequently there are many kinds of 'truths', and consequently there is no truth."

ashleyXcore

Quote from: ashleyXcore on August 28, 2006, 05:59:31 AM
You would put this:
cpm_viewRandomMediaFromAlbum(2,2,17,array("tablestyle" => "test1","imagestyle" => "test1"));
in a stylesheet?

EDIT: oh my god, I figured it out... sorry about posting here again >.<
"There are many kinds of eyes. Even the sphinx has eyes — and consequently there are many kinds of 'truths', and consequently there is no truth."

majay

Hi, thanks for this.

I have a question: is there anything in the code for get_photo.php that could stop a page where the random pictures are included from validating in XHTML 1.0 transitional?

I'm trying to validate my page, but I keep getting this message:

QuoteSorry, I am unable to validate this document because on line 56  it contained one or more bytes that I cannot interpret as utf-8

Line 56 is the line where I include my get_photo.php, like this:
<p class="random" align="center"><?include("http://path/to/get_photo.php");?></p>

When I delete the include bit only (not the p tags), the page validates fine.

This is my get_photo.php code (I'm posting it because it's not identical to djib's original code):
<?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              //

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 4;
}
$thumb_count 4;
$lower_limit 0;

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 'random';
}

//If the album is not set set it to lastup - this is the default
if(!isset($album)){
     
$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]";
    
$description '<a href="' $link_url $picture['pid'] . '"><img src="' $thumb_url '"  alt="Photo aléatoire"/></a> ';
    echo 
$description;

}
?>


Is there something wrong there? Or is my problem unrelated to this?

Thanks

helitown

I have tried this code - it works with a regular website but not with phpbb forum. Am I missing something or this code was not designed for a forum? Also, can I remove the title of the thumptail and only have the thumpnails displayed?

Joachim Müller

It wasn't specifically designed to work with phpBB. It may or may not work with it - we don't know. Probably doesn't.

helitown

Thanks GauGau so I can stop trying. I am checking cpmFetch now.

tommytomato

All i'm geting is a blank page, any idea on why its not working ?

TT