View Full Version : Another Random Images from Coppermine
steve43
06-27-2004, 07:21 PM
This allows you to add CLickable "random images" from coppermine photo gallery and display them on your vBadvanced CMPS home page as a center or side block it will also work on your vbulletin 3.0.0 & 3.0.1 FORUMHOME template.
This is an alternate to the following hacks for coppermine SSI, and RSS Feed Hack. There are a few limitations using it as a center block with vBadvanced CMPS, because of the image size and center block formatting.
ta mate have been waiting for another one ;)
I have a slight problem, its not picking up the include and showing the images, The crandom.php is tested and working fine, the module is showing fine just lack of the pictures, any ideas?
steve43
06-28-2004, 02:35 AM
########################## Displaying your images
** You must add this code to your vbulletin phpinclude_start template for your images to display***
1. add this to your vbulletin phpinclude_start template but this to reflect your site and gallery location. http://www.yoursite.com/gallery/crandom.php
//random images from coppermine//
$randomimg = implode("", file("http://127.0.0.1/gallery/crandom.php"));
//end of random images from coppermine//
2, save and close
3. Test for results.
Shack Networks
07-01-2004, 04:48 PM
Same here ?
Shack Networks
07-01-2004, 05:13 PM
BTW I did the above ?
H
I am glad I am not alone ;)
Kesomir
07-03-2004, 09:15 AM
Thanks for this, hadn't got around to writing one of these yet and randomly popped on and saw it.
Just what I needed :)
seangworld
09-28-2004, 08:32 PM
yo...im tryin to install this.
so far, im stuck here:
8. Testing file open your browser to http://www.yoursitename/yourgallery/crandom.php
if you done everything correctly your thumbnails will show, clicking the image will open that photo in your gallery.
i have a blank white page.
also, i have vb3.0.2 installed and running.
i have coppermine 1.3.2 installed. problem with this is HOW THE HELL DO YOU ADD PICS??? it's not letting me and im the damn admin. i have the users integrated with my vb as well, and i ftp'ed 5 pics to my albums dir and the dir is chmod'ed at 777.
seangworld
09-28-2004, 09:55 PM
ok, nm, i found out elsewhere that i needed to manually create folders inside my /albums, chmod them to 777, then add the pics there first, then go and do a batch upload via coppermine.
im moving onto the rest of the installation now. :P
bbensen
09-30-2004, 08:55 PM
I noticed some issues with this mod so I've made some changes.
<?php
$copperminepath = 'PATH'; //***YOU MUST CHANGE THIS***
$MZrandompic = @mysql_connect('localhost', 'USER', 'PASSWORD'); //***YOU MUST CHANGE THIS***
if (!$MZrandompic) {
echo( '<p>Unable to connect to the ' .
'database server at this time.</p>' );
exit();
}
if (! @mysql_select_db('GALLERY NAME') ) { //*** Change this to your db name ***
die( '<p>Unable to locate the picture ' .
'database at this time.</p>' );
}
$MZresult = @mysql_query("SELECT * FROM TABLEPREFIX_pictures ORDER BY RAND() LIMIT 0,6"); //*** Change the TABLEPREFIX_ to reflect yours ***
if (!$MZresult) {
die('<p>Error performing query: ' . mysql_error() .
'</p>');
}
while ( $MZrow = mysql_fetch_array($MZresult) ) {
$pos = $MZrow['pid']; //This finds the picture's coppermine location
$aid = $MZrow['aid']; // Defines Album ID
echo('<a target = "_new" href="' . $copperminepath . '/displayimage.php?album=' . $aid . '&pos=-' . $pos . '">');
echo('<IMG SRC="' . $copperminepath . '/albums/' . $MZrow['filepath']. 'thumb_' .$MZrow['filename'] . '" alt=' . $MZrow['filename'] . ' '. 'border=0 width=100 height=80>' . '</a> '); //outputs path from /userspics
}
$MZalbumresult = @mysql_query("SELECT * FROM TABLEPREFIX_albums WHERE aid = '$aid'"); //*** Change TABLEPREFIX to reflect yours
if (!$MZalbumresult) {
die('<p>Error performing query: ' . mysql_error() .
'</p>');
}
while ( $MZalbumname = mysql_fetch_array($MZalbumresult) ) {
echo('<FONT SIZE=1>');
echo('<P ALIGN=center>');
echo('<a href="' . $copperminepath .
'/thumbnails.php?album=' . $aid . '">' .
$MZalbumname['title'] . '</a>' . '</p>');
}
if (! @mysql_select_db('GALLERY NAME') ) { //*** Change this to your db name
die( '<p>Unable to reload the main website ' .
'database at this time.</p>' );
}
?>
Save the file as crandom.php
I hope this helps a bit.
bbensen
10-01-2004, 06:07 PM
I guess I wrote/spoke too soon. I can display the images on the random page, but they don't show up on the VBAdvanced portal. Is there an answer for this?
TIA,
Bill Bensen
Filou
11-12-2004, 08:32 PM
Hi .. All works fine but displayed also my nonpublic PICs :(
( PICs for a closed Usergroup )
Any Idea ???
Greetz Filou
nightwalk8r
11-24-2004, 08:39 PM
keep getting this error:
Database error in vBulletin 3.0.3:
Invalid SQL:
SELECT user.avatarid, user.avatarrevision, avatarpath, NOT ISNULL(avatardata) AS hascustom, customavatar.dateline
FROM vb3_user AS user
LEFT JOIN vb3_avatar AS avatar ON avatar.avatarid = user.avatarid
LEFT JOIN vb3_customavatar AS customavatar ON customavatar.userid = user.userid
WHERE user.userid = 2
mysql error: Table 'anim3df_copp1.vb3_user' doesn't exist
mysql error number: 1146
I'm running Vb3.0.3 and CPG 1.3.2
PLEASE help
nightwalk8r
11-25-2004, 01:31 PM
Alright i got it working =)
BTW, is there a way to restrict it from showing un-approved/ private images??
Thanks
antropus
11-27-2004, 07:17 AM
Firtst, Thanks a LOT!! I'm using and it ROCKS!
I have a question and maybe you or someone else can help me. I tried SSI.php before but was very difficult to get the same results but one thing that I saw in SSI.php is the possibility to get the last images from the coppermine table.
Maybe someone can help me to make this modification in crandom.php? I'm not looking for random images exactly but for the last 4 images from my gallery. I'm kind of newbie in php and I hope you understand :)
My forum/website where crandom.php is installed:
http://www.3d4all.org
Thanks in advance!
Kris
Is there a way to UP the image quality?
RetroDreams
02-11-2005, 04:10 PM
Has anyone got this working with 3.0.6? The crandom page works, just won't display on CMS.
RetroDreams
02-11-2005, 04:24 PM
Nevermind. If you want a 2nd way, create a new module called whatever and put the following into it:
<?php
$randomimg = implode("", file("http://www.ka-alumni.org/gallery/crandom.php"));
eval('$home[$mods[\'modid\']][\'content\'] = "' . fetch_template('adv_portal_gallery') . '";');
?>
Then, you can skip the section about putting anything into the phpinclude_start and it should work like a charm.
lionslair
04-24-2005, 06:18 AM
Have you got a link where I may see this in action?
LEAD_WEIGHT
04-24-2005, 06:50 AM
Have you got a link where I may see this in action?
Click on his signature would be a easy way to find out :p
Frankenberrie
04-29-2005, 07:17 PM
See it in action on my homepage
http://www.arcadecrazy.com
tasarimdunyasi
07-18-2005, 08:30 PM
i think i do everything correct. But modul doesnt show pics
I also added include_start template
but it still like that
3cwired_com
09-17-2005, 05:47 PM
I am not sure if anyone out there can help me, but I am trying to make this only pull from a certain album, I was playing with the code, but to no avail, I got nowhere, can someone make the necessary changes which will make this pull from a certain album.
-Brian
www.galants.org
slohand
09-26-2005, 07:27 PM
here is what I used for my block in php nuke if anyone ever comes here with a problem
<?
ob_start();
include("http://www.domainname.org/gallery/crandom.php");
$output = ob_get_contents();
ob_end_clean();
$content = "<center>$output</center>";
?>
lionslair
11-06-2005, 05:52 AM
Will this work with vbulletin 3.5.1
Glenshadow
12-05-2005, 07:43 PM
Hello all,
I am running into a weird problem with crandom.php and I can't seem to figure out why.
I am running VBulletin 3.50, VBadvanced 2.x, and Coppermine 1.42 stable.
For some reason crandom.php will fail getting an image out of the gallery if the folder it resides in is named like 12-5-05-whatever.
Basically I have my albums sorted by date and then the event.... so if for example I had pictures from Christmas I would name the folder: 12-25-05-christmas.
This folder then get's uploaded into my /albums/holidays/ folder on my site, then I go into Coppermine and add them to where ever.
The path of the image would be: domain.com/pics/albums/holidays/12-25-05-christmas/image1.jpg
At this point crandom.php does it's job and pulls the image into the area on main page, but it doesn't pull correctly... instead it will try to pull the image from: domain.com/pics/albums/holidays/12-25-05/image1.jpg
For some reason it drops the -christmas from the folder name and I have no earthly clue as to why. I didn't mod the crandom file at all except what was found in the thread on crandom.php from this site.
It doesn't make sense... it's not a issue with the number of characters in the folder name because there are long ones that work just fine. It also doesn't seem to be much of an issue with dashes in the folder name because I can have a folder called: whatever-you-want-to-call-it , and images come out of there just fine !
I am lost.... any ideas ?
I can pull my crandom.php and post it if need be... but it did the same thing with the one posted right in the thread.
slohand
12-08-2005, 08:02 AM
Post your Crandom please
Glenshadow
12-09-2005, 03:54 PM
http://www.truckporn.com/crandom.zip
Can be seen here: http://www.truckporn.com/pics/crandom.php
You might have to refresh a few times to get a broken image.
After playing around with it more... now it seems that it is trying to pull stuff that is not even there ? I am wondering if there are maybe some old entries in the database somewhere that Coppermine doesn't see at all, but since Crandom is reading from the database, it is attempting to pull them ?
This makes more sense and I think it is the problem.
cristian
01-06-2006, 07:30 AM
Hello
Crandom is cool, and works well...
But can anyone advise on how to define the album in the php, like Brian was asking above?
It would be much more versatile if you could ask crandom.php to choose random images from a particular album.
thanks agin
gblue
01-17-2006, 05:27 PM
Stupid question, I got everything installed but I cant find the phpinclude_start template where the heck is it :)
########################## Displaying your images
** You must add this code to your vbulletin phpinclude_start template for your images to display***
1. add this to your vbulletin phpinclude_start template but this to reflect your site and gallery location. http://www.yoursite.com/gallery/crandom.php
//random images from coppermine//
$randomimg = implode("", file("http://127.0.0.1/gallery/crandom.php"));
//end of random images from coppermine//
2, save and close
3. Test for results.
burley
03-20-2006, 02:47 PM
has anyone converted this to work on version 3.5.4?
I read in the 3.5 section that it wouldn't work, so let me know.
burley
03-20-2006, 06:14 PM
Stupid question, I got everything installed but I cant find the phpinclude_start template where the heck is it :)
Have you been able to install it?
arethz
06-08-2006, 02:15 AM
Hello... can anyone help me here? i am using vb 3.54 with coppermine and the crandom is working properly on www.polysucks.com/gallery/crandom.php . But I dont know how to code the template so it will displayed in a custom block.. my main page is www.polysucks.com
thanks
vBulletin® v3.8.4, Copyright ©2000-2012, Jelsoft Enterprises Ltd.