Thought some of you might find a use for this script. It will pull a random photo from the coppermine photo gallery.
The code in red can be edited to suit your needs
<?php
include_once( '/home/bowfishi/public_html/gallery/include/config.inc.php');
db_connect() || die(mysql_error());
function db_connect()
{
global $CONFIG;
$result = @mysql_connect($CONFIG['dbserver'],
$CONFIG['dbuser'], $CONFIG['dbpass']);
if (!$result)
return false;
if (!mysql_select_db($CONFIG['dbname']))
return false;
return $result;
}
$result = mysql_query("SELECT filename,filepath from cpg132_pictures WHERE
approved='YES' AND aid <> 111 and owner_name='Carver' ORDER BY RAND() DESC LIMIT 1");
$row = mysql_fetch_array($result);
$filename = 'thumb_' . $row['filename'];
$filepath = $row['filepath'];
Header('Location:http://www.mysite.com/gallery/albums/' . $filepath .
$filename);
exit;
?>
You can put this in an HTML block and call this script as an image.
<BODY>
<IMG src="http://www.mysite.com/random_pic.php">
</BODY>
Looks okay but be a bit more specific ? :)
where do we put the first part ? in a block ? use the block as php ?
Tia
Sorry,
Once you have the php code tweaked to do what you want it to do, You can edit the WHERE statement to be more or less restrictive in what the query returns, make sure to set everything to your site's path and then just save it to your server as a php file, for instance as random.php and then call that file as you would any image. <IMG src="http://www.mysite.com/random.php">
If you are going to use it as a block then place it in a HTML Block and use the <body> tags.
You can even call this php script to the forum as your avatar which is what I used it for was a random image avatar from one of my galleries....
Let me know if you need more info
Im sure there will be quite a few people looking for something like this. Good job !!!
I've been trying to get this to work, but no luck so far.
AND aid <> 111 and owner_name='Carver'
I think it's got something to do with this, but what does it do?
Quote from: YahMan on October 05, 2005, 01:56:48 AM
I've been trying to get this to work, but no luck so far.
AND aid <> 111 and owner_name='Carver'
I think it's got something to do with this, but what does it do?
That is just part of the WHERE Clause of the SQL Query.
It pretty much just says not to take Album 111 and only show pictures where the owner is equal to Carver.
So you can leave that part out of the query, unless you want only those pictures to show that belong to you then replace CARVER with your username...
In simple terms this:
$result = mysql_query("SELECT filename,filepath from cpg132_pictures WHERE
approved='YES' AND aid <> 111 and owner_name='Carver' ORDER BY RAND() DESC LIMIT 1");IS simply saying select the file name and file path from the table cpg132_pictures WHERE approved is equal to yes and the aid ( album ) is not equal to 111 and where the owner is equal to Carver, then return one picture in a random order...
make sure that your table name is not different then cpg132_pictures, it could be cpg135_pictures now or something different if you did not go with the default install when creating the database.
Here is what i do to get coppermine gallery images into the portal, thought i would share.
Downloaded and install Coppermine Fetch (CPMFetch) (http://coppermine-gallery.net/forum/index.php?board=57.0), and using a php block, add
//gallery block added
echo '<table class="tborder" border="0" width="158" cellspacing="0" cellpadding="4">
<tr><td width="100%" class="titlebg">'.$txt['portal_27'].'</td>
<tr><td class="windowbg2" width="100%" align="center">';
include "coppermine.php";
$objCpm = new cpm("/gallery");
echo ' <div align="left">';
$objCpm->cpm_formatStats("There are %f photos in the gallery <br><ul><li> %a members have albums <br><li> The gallery has beenÂÃ, viewed %v times <br><li>%n members have commented on photos </ul>");
echo '</div>';
ÂÃ, Ã‚Ã, Ã‚Ã, Ã‚Ã,Â
ÂÃ, Ã‚Ã, Ã‚Ã, Ã‚Ã, Ã‚Ã,Â
$objCpm->cpm_viewRandomMedia(1,1);
//$objCpm->cpm_close();
echo'</td></tr></table><br />';
thanks for sharing the portal bloc, it rocks and looks super!
-snork13
live demo for a limited time
www.phantasyposters.com/forum (http://www.phantasyposters.com/forum)
test/cpmfetch
Thanks for that!
Quote from: snork13 on November 05, 2005, 10:59:20 PM
Here is what i do to get coppermine gallery images into the portal, thought i would share.
Downloaded and install Coppermine Fetch (CPMFetch) (http://coppermine-gallery.net/forum/index.php?board=57.0), and using a php block, add
//gallery block added
echo '<table class="tborder" border="0" width="158" cellspacing="0" cellpadding="4">
<tr><td width="100%" class="titlebg">'.$txt['portal_27'].'</td>
<tr><td class="windowbg2" width="100%" align="center">';
include "coppermine.php";
$objCpm = new cpm("/gallery");
echo ' <div align="left">';
$objCpm->cpm_formatStats("There are %f photos in the gallery <br><ul><li> %a members have albums <br><li> The gallery has beenÂÃ, viewed %v times <br><li>%n members have commented on photos </ul>");
echo '</div>';
$objCpm->cpm_viewRandomMedia(1,1);
//$objCpm->cpm_close();
echo'</td></tr></table><br />';
thanks for sharing the portal bloc, it rocks and looks super!
-snork13
live demo for a limited time
www.phantasyposters.com/forum (http://www.phantasyposters.com/forum)
test/cpmfetch
Using the CMG-Fetch - the php code above gives me this !error:!
Fatal error:
Cannot instantiate non-existent class: cpm in /home/cripsite/public_html/forum/Sources/Load.php(1598) : eval()'d code(32) : eval()'d code on line 5
Is there another way of doing this? - I ran the test/cpmfetch.php and every thing passed and it showed 8 thumbnail files thats located in my Gallery.
Thanks,
crip~
set up your coppermine.php and put this in a block:
print "A random selection:<CENTER>";
include "../gallery/cpmfetch/coppermine.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewRandomMedia(1,1);
$objCpm->cpm_close();
print "</center>";
Sure works 4us :-)
Quote from: domp on November 21, 2005, 06:40:03 PM
set up your coppermine.php and put this in a block:
print "A random selection:<CENTER>";
include "../gallery/cpmfetch/coppermine.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewRandomMedia(1,1);
$objCpm->cpm_close();
print "</center>";
Sure works 4usÂÃ, :-)
yes, sorry i moved coppermine.php in the forum directory
Wow,
I was just stating to ask if the gallery directory should be inside the forum directory.. :D
actually with the new release cpmFetch, it is the cpmfetch.php not the coppermine.php to call up.
Doug
http://jaxdoug.com :2funny:
Can it be used without Copper mine? Like how can I get something like this to work by just pull pictures out of the attachments folder on my forum?
I'm getting the same fatal error. Does coppermine have to be within the forum directory? What needs to happen?
Fatal error: Cannot instantiate non-existent class: cpm in /home/content/s/o/t/sotgu003/html/hawaiifighter/Sources/Load.php(1040) : eval()'d code(32) : eval()'d code on line 7
No it doesnt need to be in the same directory. I have the three directories in root: smf, cpg (coppermine), and cpmfetch (Coppermine fetch). Using the code beow I have random images showing in a block on the front page.
print "A random selection from our Gallery:<CENTER>";
include "../cpmfetch/cpmfetch.php";
$objCpm = new cpm("/cpg");
$objCpm->cpm_viewRandomMedia(1,5);
$objCpm->cpm_close();
print "</center>";
(Line 4 denotes 1 row of 5 photos)
Quote from: gerrymo on December 11, 2005, 09:50:28 PM
No it doesnt need to be in the same directory. I have the three directories in root: smf, cpg (coppermine), and cpmfetch (Coppermine fetch). Using the code beow I have random images showing in a block on the front page.
print "A random selection from our Gallery:<CENTER>";
include "../cpmfetch/cpmfetch.php";
$objCpm = new cpm("/cpg");
$objCpm->cpm_viewRandomMedia(1,5);
$objCpm->cpm_close();
print "</center>";
(Line 4 denotes 1 row of 5 photos)
Same error:
> A random selection from our Gallery:
Fatal error: Cannot instantiate non-existent class: cpm in /home/tnqudus1/public_html/forum/Sources/Load.php(1598) : eval()'d code(32) : eval()'d code on line 3
what happened?
Hopeless
Is there somewhere with cpmfetch to configure the images so that they can't be clicked and take the user to the gallery?
Quote from: crip on December 11, 2005, 10:02:31 PM
Hopeless
Not at all. It does depend on which versions you are using. The best place to find out more is over at Coppermine http://coppermine-gallery.net/forum/ The codes above work for me.
Quote from: crip on December 11, 2005, 10:02:31 PM
Hopeless
I think it's a problem with your path ? I'm not sure but i know i'be spend a lot of time to confugure coppermine/cpmfetch.
Ok..
I read everything and came up with this and it still sends Errors....
./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewRandomMedia(1,1);
$objCpm->cpm_close();
Thats what I put be stillll errors, but the cmptest.php works great..anyone willing to help a poor helpless Wet Naked cripple!?! >:D :2funny: :knuppel2:
crip~
ok, what version of cpmfetch & version of smf!
Location of software install on server.
i d/l recent cpmfetch, and have it running on my index page.
sample--> http://www.phantasyposters.org/ (http://www.phantasyposters.org/)
what i did on my index page :):
<?
echo'<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Language" content="en-us">
<meta name="ROBOTS" content="ALL">
<meta name="Copyright" content="Copyright (c) ME snork13">
<meta http-equiv="imagetoolbar" content="no">
<meta name="MSSmartTagsPreventParsing" content="true">
<meta name="Rating" content="General">
<meta name="revisit-after" content="5 Days">
<meta name="doc-class" content="Living Document">
<meta http-equiv="pragma" content="no-cache">
<link rel="icon" href="images/favicon.ico" type="image/ico" >
<title>Phantasyposter - Dev</title>
<style type="text/css">
img.test1 {
border-style:solid;
border-width:1px;
border-color: #666666;
margin: 7px;
filter:progid:DXImageTransform.Microsoft.dropshadow(OffX=5, OffY=5, Color=#cccccc, Positive=true); }
</style>
</head>
<body>
<table align="center"><td colspan="2"> </td></tr>
<tr><td width="100"align="center" style="padding-bottom: 7px;" class="gal">';
include "/home/LOCATION ON Your Server/cpmfetch/cpmfetch.php";
$objCpm = new cpm('/gallery');
$options = array( 'subtitle' => 'Photo added %D days ago<br />Views [ %h ]' , 'imagestyle' =>"test1");
$objCpm->cpm_viewRandomMedia (2,1,$options);
echo'</td></tr></table>
<div align="center">
<p>Welcome</p>
<p><a href="http://www.phantasyposters.org/forum">Enter</a> </p>
</div>
</body>
</html>
'; ?>
--snork13
What about using somethiing different than Coppermine? ..such as (folderblog) .. it'a a small php script, without a database..can I show a random photo with this in a block??
my Url : http://www.tnquad.us/fb/fb.php
Tanks,
crip~
@crip
yes, i'm sure you could use a number of photo gallery scripts, as well as the one bloc is working on, i noticed another new photo gallery design for smf just the other day. I'm just saying i have experience with coppermine, i feel at home with it...so this is what i use. I did setup the coperminefetch in about 5 mins, had to do the comment one line, open the other for it to work with 1.42 coppermine. if you need any help contact me via pm...
-snork13
Ty snork13,
I do appericate it. :)
crip~
Hi :)
I use this block:
(https://www.tinyportal.net/proxy.php?request=http%3A%2F%2Fimg445.imageshack.us%2Fimg445%2F6899%2Fsamplecfetch7kj.jpg&hash=546ce7ce2a7ac60c7afc06240d60b19db9e74380)
Make a new block, phpbox and put the code (please, check the patchs)
And the code is:
<?php
echo '
<style type="text/css"><!--
.test1 { border-width:0px;}
--></style>';
echo '<div align="center">';
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/coppermine");
echo ' <div align="center">';
echo ' <b><u>Stats</u></b><br>';
$objCpm->cpm_formatStats("Albums: <b>%a</b> <br> Images: <b>%f</b> <br> Clicks: <b>%v</b> <br> Comments: <b>%n</b> <br><br>");
echo '</div>';
echo ' <b><u>Last Image</u></b><br>';
$options = array( 'subtitle' => '<b>%a</b> <br> Name: <b>%t</b> Author: <b>%o</b> <br> Here since <b>%D</b> days <br> Clicks: <b>%h</b> <br> Score: <b>%V</b>' , "imagestyle" => "test1");
$objCpm->cpm_viewLastAddedMedia(1,1,$options,);
//$objCpm->cpm_close();
echo'</div>';
?>
Hope everyone is enjoying the holiday season!
Maybe not the right place but since I learn about cpmfetch from you guys... :)
I have a problem with cpmfetch and not sure where to start fixing it. I defined my coppermine folder and everything passed in the cftest.php file. But when the part of the cftest shows some thumbnails I get
QuoteTrying to display some images:
Your installation seems correct so far, you should see a small grid of thumbnails from your gallery
Unknown column 'u.user_website' in 'field list'
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /home/ynohtna/websites/elmira-anthony.ca/cpmfetch/cpmfetch_dao.php on line 710
If you do not see thumbnails, or get more warnings then something is pretty wrong. As long as you are using standard prefixes in Coppermine, you should see everything. If you are not using standard prefixes, then you need to adjust them by editing the first three variables in the cpmfetch.php file.
I just installed cpg for the first time today and I installed 1.4.3. I installed cpg, put some files online and then integrated with SMF using the bridge integrator.
What could be the problem? I didn't really change any prefixes except that the database tables for cpg start with cpg and not the default cpg143. While the cpmfetch help say I may need to check these for non-standard prefixes
Quote//The following 3 entries can be adjusted if you are using non-standard prefixes in CPG
var $thumbnailprefix = "thumb_";
var $intermedprefix = "normal_";
var $fullsizeprefix = '';
var $defaultimagesize = "thumb_";
I didn't change anything... where do I find these thumb_ prefixes? are they database tables? Because I have no tables with thumb_ prefixes.
Many thanks.
my problem was fix by opening up cpmfetch_dao.php and commenting out the line for the query reference for CPG version prior to 1.4 and uncommenting the one for cpg 1.4.1 beta1
I'm using cpg 1.4.3 (stable)
// This is for CPG versions prior to 1.4
/*
var $sqlPictureAlbumSelect = ' p.filepath AS pFilepath, p.filename AS pFilename, p.aid AS pAid, p.filesize AS pFilesize, p.title AS pTitle, p.caption AS pCaption, p.owner_name AS pOwner_name, p.owner_id as pOwnerId, p.ctime AS pCtime, p.hits AS pHits, a.title AS aTitle, a.description AS aDescription, p.pid AS pPid, p.pic_rating AS pPic_Rating, p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email, u.user_website AS uUser_website, u.user_location AS uUser_location, u.user_interests AS uUser_interest, u.user_occupation AS uUser_occupation';
*/
// This is for CPG v 1.4.1 beta 1
var $sqlPictureAlbumSelect = ' p.filepath AS pFilepath, p.filename AS pFilename, p.aid AS pAid, p.filesize AS pFilesize, p.title AS pTitle, p.caption AS pCaption, p.owner_name AS pOwner_name, p.owner_id as pOwnerId, p.ctime AS pCtime, p.hits AS pHits, a.title AS aTitle, a.description AS aDescription, p.pid AS pPid, p.pic_rating AS pPic_Rating, p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email';
just thought I would let you look at something I been working on with another portal, I have coppermine on a page, check it out at http://jaxdoug.com/e2themes/index.php?page=gallery.
Doug :idiot2:
wooo you have a nice little write up for that? I've seen some writeups to integrate gallery right into SMF... but I kinda got lost in it all. Is this gallery intergrated to TP or SMF or ?? :)
I use gallery and have it in smf as a block
www.rranderson.com
I use a script by kegobeer with more options (I haven' t tried CMPfetch)
http://www.simplemachines.org/community/index.php?topic=16538.0 or
http://pictures.kazebeer.com/coppermine/displayimage.php?album=6&pos=0
It adds a function in SSI with parameters.
QuoteÂÃ, ##ÂÃ, When calling this function, there are four variables you can set.
ÂÃ, ##ÂÃ, The number of pictures to display, last updated/random images,
ÂÃ, ##ÂÃ, where the Coppermine directory is (relative to where the file
ÂÃ, ##ÂÃ, that's calling this function, and the output method.
You can use it in many ways with SMF and TP.
JaxDoux, CPG can be easily integrated into TP with the plus of very easy collapse of the side blocks without leaving TP. This last is important if someone has big photos. As I am testing TP in my PC, to the moment I see my CPG gallery (in my server) in an article with IFRAME (in my PC).
Impressive result Ray but I think the gallery it is not CPG.
QuoteImpressive result Ray but I think the gallery it is not CPG.
No it is not yet - I just wanted to show how it can look ;D and I like gallery a lot
looks interesting ray, i did the same with coppermine.
www.snork13.net (http://www.snork13.net)
What kind of Portal is it?
Looks good..will BlackChrome be TP ready?
Looking good snork13 :P
Quotefunction ssi_CoppermineImages($num_pics = 5, $order = 'lastup', $wherescoppermine = 'coppermine/', $output_method = 'echo')
{
## When calling this function, there are four variables you can set.
## The number of pictures to display, last updated/random images,
## where the Coppermine directory is (relative to where the file
## that's calling this function, and the output method.
##
## Default values are 5, 'lastup', 'coppermine/', 'echo'
## If you need to skip a default value, use null. For example, (null, 'random') displays 5 random
## images.
##
## The variable $wherescoppermine depends on where you are calling ssi_CoppermineImages from.
## For example, my directory structure is like this: root -> coppermine
## root -> smf
## If I call ssi_Coppermine from a file located in root, the variable would be coppermine/
##
## Here are a few examples:
## To display 10 random images, you'd call: ssi_CoppermineImages(10, 'random');
## To get the last 5 updated images into an array, you'd call: ssi_CoppermineImages(null,null,null,'return');
if (is_null($wherescoppermine)) $wherescoppermine = 'coppermine/';
if (is_null($order)) $order = 'lastup';
if (is_null($num_pics)) $num_pics = 5;
if (is_null($output_method)) $output_method = 'echo';
$cpgtable = 'cpg132_'; // Change to your Coppermine table prefix
$titlelen = 15; // Maximum number of letters displayed under the pictures
$return = array();
$cpgConfig = array();
$result55 = db_query("
SELECT extension, mime, content
FROM {$cpgtable}filetypes", __FILE__, __LINE__);
while ($row = mysql_fetch_array($result55))
$file_types[$row['extension']] = $row;
mysql_free_result($result55);
$temp55 = db_query("
SELECT *
FROM {$cpgtable}pictures
WHERE approved='YES'", __FILE__, __LINE__);
$return['pic_total'] = mysql_num_rows($temp55);
mysql_free_result($temp55);
$temp55 = db_query("
SELECT *
FROM {$cpgtable}albums", __FILE__, __LINE__);
$return['alb_total'] = mysql_num_rows($temp55);
mysql_free_result($temp55);
$temp55 = db_query("
SELECT * FROM {$cpgtable}config", __FILE__, __LINE__);
while ($row55 = mysql_fetch_array($temp55))
$cpgConfig[$row55['name']] = $row55['value'];
mysql_free_result($temp55);
$fullpath = $cpgConfig['fullpath'];
$cpgpath = $cpgConfig['ecards_more_pic_target'];
if ($order == 'lastup')
$orderby = 'pid';
else
$orderby = 'RAND()';
$request5 = db_query("
SELECT pid, filepath, filename, filesize, title, aid
FROM {$cpgtable}pictures
WHERE approved='YES'
ORDER BY $orderby DESC
LIMIT $num_pics", __FILE__, __LINE__);
$imagecounter = 0;
$return['pictures'] = array();
while ($row5=mysql_fetch_array($request5))
{
$imagecounter++;
$filename = $row5['filename'];
if (!is_array($filename))
$filename = explode('.',$filename);
$EOA = count($filename)-1;
$filename[$EOA] = strtolower($filename[$EOA]);
$mime_content = $file_types[$filename[$EOA]];
$filepathname = null;
$custom_thumb = null;
$custom_thumb_path = $wherescoppermine.$fullpath.$row5['filepath'].'thumb_';
if ($mime_content['content'] != 'image')
{
$thumb_extensions = Array('.gif','.png','.jpg');
$file_base_name = str_replace('.'.$mime_content['extension'],'',basename($row5['filename']));
foreach ($thumb_extensions as $extension)
{
if (file_exists($custom_thumb_path.$file_base_name.$extension))
{
$filepathname = $custom_thumb_path.$file_base_name.$extension;
$custom_thumb = 1;
break;
}
}
if (is_null($filepathname))
{
foreach ($thumb_extensions as $extension)
{
if (file_exists($wherescoppermine.'images/thumb_'.$mime_content['extension'].$extension))
{
$filepathname = $wherescoppermine.'images/thumb_'.$mime_content['extension'].$extension;
break;
}
}
}
}
else
{
$filepathname = $custom_thumb_path.$row5['filename'];
}
if ($orderby == 'pid')
$display = 'lastup&&cat=0&pos='.($imagecounter-1);
else
$display = 'random&&cat=0&pos=-'.$row5['pid'];
$return['pictures'][] = array(
'imagelnk' => $wherescoppermine.'displayimage.php?album='.$display,
'imageurl' => $filepathname,
'imagetitle' => (strlen($row5['title']) > $titlelen ? substr($row5['title'],0,$titlelen).'...' : $row5['title']) . ($mime_content['content'] != 'image' ? ($custom_thumb == 1 ? ($row5['title'] != '' ? '
' : '').'('.$mime_content['content'].', '.round($row5['filesize']/1024).'K)' : '
('.round($row5['filesize']/1024).'K)') : '')
);
}
mysql_free_result($request5);
if ($output_method == 'echo')
{
foreach($return['pictures'] as $pictures)
{
echo '
<div class="div" style="float: left; width: 150px; height: 130px; text-align: center;">
<a href="' . $pictures['imagelnk'] . '">
<img src="' . $pictures['imageurl'] . '" height="100" width="100" border="0" alt="" /></a>
<span style="font-size: x-small">'.$pictures['imagetitle'].'</span></div>';
}
echo '
<div style="clear: both;"></div>
<span>The Gallery has ' . $return['pic_total'] . ' files in ' . $return['alb_total'] . ' albums. You should go <a href="'.$wherescoppermine.'index.php">see</a> them!</span>';
}
else
{
return $return;
}
}
So how do I make this work..in TP or a page by itself?...can you tell more more on how-to?
crip~
you would have to call the correct path for the ssi_CoppermineImages file on your server, or ssi file on your server if it's not seperate
I been thinking how I could use [cftest.php] file/page and use the Random Images it displays?
I'd remove everything on that page/file - phpinfo - test..et-ceteras, and leave only the part that
shows the Random image?..is this possible?
* Input please*, I have read and tried everything here; and @ FistFullOfCode also..
Later, Crip~ ;D
I have this Random Image working on my website, but we can't use a code like this in TP_can we?
<?php
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewRandomMedia(1,1);
$objCpm->cpm_close();
?>
Later, Crip~
That code runs OK in a block on our site!
Had it up for a while.
php block, or html.. which kind, Article?
Standard php block or php article, works with either.
I finally managed to get a Random Image display in a phpbox on my site by simeply moving the cpmfetch **/ Directory/** into my forum **/ Directory/** .. and changed the path a bit.. so those of you who have struggled as I have to get a Random image displayed in a php/block I hope this bit helps you.
This is the code I used:
print "A random selection:<CENTER>";
include "../cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewRandomMedia(1,1);
$objCpm->cpm_close();
print "</center>";
Later, Crip~ ;D
You also need to remove the php tags Crip. Your post at the top of the page has tags in it (1st and last lines to be removed).
I did, I used the new code below that code.
They actually both worked for me (minus tags).
gald you got it to work crip...it's all about the fiel placement with with cpmfetch...i have it running, outside coppermine, inside coppermine..on different servers pointing to ech other. i think a great script, and now with rss added...updates to the gallery should be cool :)
Crip,
I know how you felt when you were struggling with this earlier. I have been at this most of the day trying everything I have read and not getting anywhere fast.
I have Coppermine 143 running with SMF RC2 and latest TP version.
I re-installed a fresh gallery, fresh cpmfetch 1.6.2, and while I am not getting errors from the cftest page I am not getting any images either.
I had the coppermine bridge active and now inactive, and that does not seem to matter. I do have this working on the same server on another one of my sites and it went without a hitch, I duplicated that setup to no avail. That forum is running TP075 and SMF RC1 without the bridge to coppermine..
any thoughts would be greatly appreciated, so would any offer of help at this point..
www.gardenrefuge.com/gallery
www.gardenrefuge.com
if someone is willing to take a whack at this let me know in a PM and I will get you admin rights to the site..
Curt
I still use the very stable 1.4 version..seems to work better..I've tried them all..
Thanks Jeff I try that!
Its about the only thing I have not tried today!
Thanks!
Curt
Jeff, that worked, should of came here and asked hours ago.. Go figure.. the lastest and greatest is not always the best..
Thanks Again
Curt
Glad it worked. :)
Later, crip
Where an download the CPMFetch files ?? I found a lot of topics discussing CPMFetch but I could not find the files.
You can pick your download for fetch here...
Coppermine Fetch (http://www.fistfullofcode.com/projects/copperminefetch/downloads.php)
I tried reading the documententation for the cpmfetch but I'm still a little confused, is there a way to show the filename under the file?,
t.y.i.a.,
Angel
Quote from: carver on February 20, 2006, 03:15:48 AM
You can pick your download for fetch here...
Coppermine Fetch (http://www.fistfullofcode.com/projects/copperminefetch/downloads.php)
Thank-you!
Quote from: MetalHellsangel on February 20, 2006, 08:04:54 AM
I tried reading the documententation for the cpmfetch but I'm still a little confused, is there a way to show the filename under the file?,
t.y.i.a.,
Angel
It shows the file name on mouse Hover.
I finaly got this to work but it's only grabbing my uploaded images.
I've tried changing some of the values like it said in the readme but none of it works. Anyone else having this?
Here's what I am using. (Teck's code he posted, slighty changed)
echo '<div align="center">';
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/galleries/");
$objCpm->cpm_unlock_private(); /* <--I've tried setting this to (true) but it gives me errors.*/
echo ' <div align="left">';
echo ' <b>Stats</b><br>';
$objCpm->cpm_formatStats("Albums: <b>%a</b> <br> Images: <b>%f</b> <br> Hits: <b>%v</b><br><br>");
echo '</div><div align="left"><b>Random Reference</b><br>';
$options = array( 'subtitle' => 'Name: <b>%t</b><br> Author: <b>%o</b> <br> Here since <b>%D</b> days <br>' , "imagestyle" => "test1");
$objCpm->cpm_viewRandomMediaFrom ( 1, 1, $source = "", $options);
$objCpm->cpm_close();
echo'<p><a href="http://pixelmorgue.com/galleries/index.php?cat=8"><u>Photo References</u></a></p></div></div>';
I've went through all the setting making sure guest have access and that it reads from all categories but no luck.
Are you using the lastest version of cpmfetch?
Yeah, I just downloaded a few hours ago.
copperminefetch-1.6.2
I use the 0.4 stable version of cpmfetch, I was having problems with that version so I swicth and everything works well now..
maybe you can try an earlier stable version will help?
Awesome, I download 1.4.0 and changed one setting and it works perfect, thanks! :)
I would of never of thought to downgrade hehe
Glad it worked. :)
I was just about to give up and call it a day until i ran across this gem of info....
Quote from: ÂÃ,»cripÂÃ,« on February 26, 2006, 11:51:59 PM
I use the 0.4 stable version of cpmfetch, I was having problems with that version so I swicth and everything works well now..
maybe you can try an earlier stable version will help?
And now the world makes sense again!! ;D
So how can I have a block on my frontpage with 1 row of 5 random images (obviously thats the simple part I just said it to be thorough and detailed which I have this already done) though when clicked they need to open inside my site in the tinyportal framework rather then opening its own complete page?
t.i.a.
Can I random photos from members? not only from Admin?
I get this error message in the right block:
A random selection:
ERROR: Path to Coppermine incorrect. (//cpg143//include/config.inc.php)
With this code:
print "A random selection:<CENTER>";
include "../forum/cpmfetch/cpmfetch.php";
$objCpm = new cpm("/cpg143");
$objCpm->cpm_viewRandomMedia(1,1);
$objCpm->cpm_close();
print "</center>";
Any suggestions?
Do I have to use cmfetch for this to work? I created the block and all but no image is showing up.
www.foreverpurple.com/bb
Quote from: carver on September 22, 2005, 01:32:19 AM
Thought some of you might find a use for this script. It will pull a random photo from the coppermine photo gallery.
The code in red can be edited to suit your needs
<?php
include_once( '/home/bowfishi/public_html/gallery/include/config.inc.php');
db_connect() || die(mysql_error());
function db_connect()
{
global $CONFIG;
$result = @mysql_connect($CONFIG['dbserver'],
$CONFIG['dbuser'], $CONFIG['dbpass']);
if (!$result)
return false;
if (!mysql_select_db($CONFIG['dbname']))
return false;
return $result;
}
$result = mysql_query("SELECT filename,filepath from cpg132_pictures WHERE
approved='YES' AND aid <> 111 and owner_name='Carver' ORDER BY RAND() DESC LIMIT 1");
$row = mysql_fetch_array($result);
$filename = 'thumb_' . $row['filename'];
$filepath = $row['filepath'];
Header('Location:http://www.mysite.com/gallery/albums/' . $filepath .
$filename);
exit;
?>
You can put this in an HTML block and call this script as an image.
<BODY>
<IMG src="http://www.mysite.com/random_pic.php">
</BODY>
caver, just refresh screen gets new picture.
other case always same picture ???
Is it possible to do the same thing with the latest pictures uploaded?
Got a working example somewhere
Well this looks like what I have been looking for for my avatars but I am totally new to this block stuff
any chance of getting some step by step help to do this so I can get an idea what you are talking about
cmpfetch script has a step by in it for random Avatar
I appreciate the comeback
but
I am really new to this stuff
whats " cmpfetch script " mean
where do I find it
what do I do with iy once I find it
Garry, I know you're looking for the easy answers all in one place. But you'll find you learn a lot more by searching around. A simple google search will show you what and where to find cpmfetch. Click me (http://www.google.com/search?q=cmpfetch&start=0&ie=utf-8&oe=utf-8&client=firefox-a&rls=org.mozilla:en-US:official)
As to what to do with it, if you search in these forums you'll also find your answer.
Well I looked as you sugested and all I found was information from people trying to use it but nothing to tell me where to find it
Open to another sugestion
grin
I went to the first link in google. Looked in the forum. Found a stickie for it. And now for your pleasure, here is the downloads page.
http://www.fistfullofcode.com/projects/copperminefetch/downloads.php
Thank you for the link and the instructions
I followed your instructions and also found it
I never thought of straying of the post i went to originally , as with 46 pages of posts i would get lost in never never land and forget why I was there in the first place
I have put random images on my blocks with the help of this site, what I need to do now is make the thumb images on my site the same size? any ideas on what but to edit in cpmfetch to make them the same?
Regards
Blink
There is a readme file in the cpmfetch download that explains all of this and how to do it.
I do my best to search and try things myself Gargoyle and only ask for help if I am really stuck. I have struggled with the help file, I have spent all day trying to do this myself and at a last resort I asked for help.
Oh I see... I only suggested the help file because it took me about 3 hours to figure it all out and I don't remember most of what I did to get it to work right... LOL!!
Anyway here is the code from my block on my site that I was using... It's a left or right block and displays additional info when you hover etc... Maybe this will help you out some ??
print "<center>";
include "../cpmfetch/cpmfetch.php";
$objCpm = new cpm("/your gallery directory name");
$objCpm->cpm_viewRandomMedia(1,1,array("imagesize" => "Thumb","windowtarget" => "_new","subtitle" => "Added by %o ( %S KB )","alttag" =>"From Album: %a Added: %w"));
$objCpm->cpm_close();
print "</center>";
Thanks for that but I have 6 images in a centre block and the thumbs are different sizes. I would like to make the thumbs a bit neater and all the same size. If you could point me in the direction I will play about with it.
Regards
Blink
my cpmfetch files are on my other computer... Gimmie some time and I'll find the section that deals with that..
thanks.
Well it took me a bit to find my files but this is the code I have "working" on my site. It is one row of 6 images and they are all sized the same. I have tested this and it has worked well for me so hopefully this is what will help you.Ã, ;)
print "<center>";
include "../cpmfetch/cpmfetch.php";
$objCpm = new cpm("/your gallery directory name");
$objCpm->cpm_viewRandomMedia(1,6,array("imagesize" => "Thumb","imageheight" => "75","imagewidth" => "100","windowtarget" => "_new","alttag" =>"From Album: %a Added: %w"));
$objCpm->cpm_close();
print "</center>";
I appreciate the time you have spent as it did the trick. I am very grateful.
Blink
I'm just glad I could finally help someone.. :D
Hey guys, I have a huge problem. I got my cpmfetch to work, in that I am able to see pictures from my gallery. However, the problem is that it is only calling pictures from ONE particular album in my gallery when I use this:
print "<center>";
include "../cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewRandomMedia(4,1, array("imagesize" => "Thumb","windowtarget" => "_new","subtitle" => "Member: %o - %c "));
$objCpm->cpm_close();
print "</center>";
I have tried to add "cat=1" after stipulating the rows and columns of pictures, but that just produces an error. Seems this thing is only calling pictures from a particular album uploaded by the admin, and refuses to touch the users album even though they are not private. Can someone please help a frustrated person out? I would greatly appreciate it. :-\
I used this instead of Random media cpm_viewLastAddedMedia
thanx blink, but it still won't touch users albums. anything else? anybody? :-\
here is my code, you can change the amount of thumbs to show. It sound like a coppermine permissions issue though.
Quoteprint "<CENTER>";
include "../cpmfetch/cpmfetch.php";
$objCpm = new cpm('/gallery');
$objCpm->cpm_viewLastAddedMedia (1,8,array("imagesize" => "Thumb","imageheight" => "75","imagewidth" => "75","windowtarget" => "_new","alttag" =>"From Album: %a Added: %w"));
$objCpm->cpm_close();
print "</center>";
I have SMF1.1RC2, Tinyportal 0.8.6, Coppermine 1.4.5 and cpmfetch 1.6.2.
I am trying to display a random photo on my site in a phpblock, but before that, the cftest.php gives me following error:
Unknown column 'u.user_website' in 'field list'
Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in /var/www/vhosts/mydomain.com/httpdocs/gallery/cpmfetch/cpmfetch_dao.php on line 710
Anyone had this error? What may be wrong?
Answering my own question, maybe it might help to other people:
You need to comment OUT the line
// This is for CPG versions prior to 1.4
/* var $sqlPictureAlbumSelect = ' p.filepath AS pFilepath, p.filename AS pFilename, p.aid AS pAid, p.filesize AS pFilesize, p.title AS pTitle, p.caption AS pCaption, p.owner_name AS pOwner_name, p.owner_id as pOwnerId, p.ctime AS pCtime, p.hits AS pHits, a.title AS aTitle, a.description AS aDescription, p.pid AS pPid, p.pic_rating AS pPic_Rating, p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email, u.user_website AS uUser_website, u.user_location AS uUser_location, u.user_interests AS uUser_interest, u.user_occupation AS uUser_occupation';
*/
and UNcomment the line right below it:
// This is for CPG v 1.4.1 beta 1
var $sqlPictureAlbumSelect = ' p.filepath AS pFilepath, p.filename AS pFilename, p.aid AS pAid, p.filesize AS pFilesize, p.title AS pTitle, p.caption AS pCaption, p.owner_name AS pOwner_name, p.owner_id as pOwnerId, p.ctime AS pCtime, p.hits AS pHits, a.title AS aTitle, a.description AS aDescription, p.pid AS pPid, p.pic_rating AS pPic_Rating, p.votes AS pVotes, p.pwidth AS pWidth, p.pheight AS pHeight, u.user_lastvisit AS uUser_lastvisit, u.user_regdate AS uUser_regdate, u.user_email AS uUser_email';
in your cpmfetch_dao.php.
Added to block code index under "c" as "coppermine: Random images block"
does anyone have this error?
Fatal error: Cannot instantiate non-existent class: cpm in /projects/smfteste/Sources/Load.php(1607) : eval()'d code(34) : eval()'d code on line 4
I look in this topic and found that we have include coppermine.php
But where are coppermine.php?
Thanks
coppermine.php was included with older versions of cpmfetch. Newer versions have cpmfetch.php, you may need to change the filename to cpmfetch.php.
Does anyone have a way to do this with just PHP or java code instead of installing more software
You can also look at the forum support on Coppermine_gallery.net, they have some great threads about how to use cpmFETCH ;)
Thanks I have it downloaded and can the test.php file and got it to work but the install.php does not put say
/** * RELEASE VERSION: 1.6.4 * * This is the installation program for CpmFetch. * * Usage: Call this file from a web browser and follow the instructions * */
Anyone have this before, I have yet to find the answer
HMM, cant say i have had any problems with that when i tried.
But the first place i would have looked for the answers for cpmfetch would be on Coppermine forums as it's their software and not TP's ;)
I have been looking there and was just hoping someone here has seen it. Did you run install.php when you used it
If i remember correct it was install.php
But you have to place the cpmfetch in your forum folder so the url to the file will be like
/forum/cpmfetch/install.php
I found the link to the site where i got mine from.
Browse there and read all about cpmfetch there.
http://cpmfetch.fistfullofcode.com/projects/copperminefetch/index.php
Yeah I have been reading that site, I downloaded a dev version and the install ran but no test images loaded so I am looking into that now
Quote from: evillair on February 26, 2006, 11:14:10 PM
I finaly got this to work but it's only grabbing my uploaded images.
I've tried changing some of the values like it said in the readme but none of it works. Anyone else having this?
Here's what I am using. (Teck's code he posted, slighty changed)
echo '<div align="center">';
include "./cpmfetch/cpmfetch.php";
$objCpm = new cpm("/galleries/");
$objCpm->cpm_unlock_private(); /* <--I've tried setting this to (true) but it gives me errors.*/
echo ' <div align="left">';
echo ' <b>Stats</b><br>';
$objCpm->cpm_formatStats("Albums: <b>%a</b> <br> Images: <b>%f</b> <br> Hits: <b>%v</b><br><br>");
echo '</div><div align="left"><b>Random Reference</b><br>';
$options = array( 'subtitle' => 'Name: <b>%t</b><br> Author: <b>%o</b> <br> Here since <b>%D</b> days <br>' , "imagestyle" => "test1");
$objCpm->cpm_viewRandomMediaFrom ( 1, 1, $source = "", $options);
$objCpm->cpm_close();
echo'<p><a href="http://pixelmorgue.com/galleries/index.php?cat=8"><u>Photo References</u></a></p></div></div>';
I've went through all the setting making sure guest have access and that it reads from all categories but no luck.
This one worked for me!
Hi. I added the short random pic script at the beginning of this thread here: http://www.tinyportal.net/smf/index.php?topic=822.0 Do you have any thoughts on how I can limit the thumbnails displayed to the highest rated images?
Thanks so much!
I have read a ton on cpmfetch and 'random image scripts'
Do I really need fetch or is the random script okay ?
I know there is a few more functions with fetch than just 'show pics'.
I actually have a random image script running fine now, but the calls are from smf gallery lite. Had to breakdown and go with coppermine because it just has more stuff..hehe
don't want to install what I don't need is why Im asking..
Quote from: blink on July 13, 2006, 05:53:41 PM
here is my code, you can change the amount of thumbs to show.Ã, It sound like a coppermine permissions issue though.
Quoteprint "<CENTER>";
include "../cpmfetch/cpmfetch.php";
$objCpm = new cpm('/gallery');
$objCpm->cpm_viewLastAddedMedia (1,8,array("imagesize" => "Thumb","imageheight" => "75","imagewidth" => "75","windowtarget" => "_new","alttag" =>"From Album: %a Added: %w"));
$objCpm->cpm_close();
print "</center>";
This code works GREAT!!Ã, Thanks!
Is there any way to make it so the pics can be bigger without being blurry?
Okay...almost there... installed cpmfetch, and used this code
print "<center>";
include "../cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewRandomMedia(1,5,array("imagesize" => "Thumb","imageheight" => "78","imagewidth" => "104","windowtarget" => "_new","alttag" =>"From Album: %a Added: %w"));
$objCpm->cpm_close();
print "</center>";
Have the gallery coming in to an i-frame right now and it looks great, but when u click any of the pics in this block, it takes u to a new page of just the coppermine gallery.
Any way to make it call up the 'gallery' iframe page?
Here is another "incarnation"
I like to live life on the edge so this works with cpmfetch v1.94
echo "A random selection:<CENTER>";
chdir("gallery/cpmfetch/");
include "cpmfetch.php";
$objCpm = new cpm();
$objCpm->cpm_viewRandomMedia(1,1);
$objCpm->cpm_close();
chdir("../../");
echo "</center>";
**Please don't ask me for support...because I only wear it.
Quote from: Maya on November 18, 2006, 06:28:08 AM
Okay...almost there... installed cpmfetch, and used this code
print "<center>";
include "../cpmfetch/cpmfetch.php";
$objCpm = new cpm("/gallery");
$objCpm->cpm_viewRandomMedia(1,5,array("imagesize" => "Thumb","imageheight" => "78","imagewidth" => "104","windowtarget" => "_new","alttag" =>"From Album: %a Added: %w"));
$objCpm->cpm_close();
print "</center>";
Have the gallery coming in to an i-frame right now and it looks great, but when u click any of the pics in this block, it takes u to a new page of just the coppermine gallery.
Any way to make it call up the 'gallery' iframe page?
None that I know of at the moment.
Hi,
everytime when i try to run install.php. The following message come up
/** * RELEASE VERSION: 1.6.4 * * This is the installation program for CpmFetch. * * Usage: Call this file from a web browser and follow the instructions * */
Could anyone explain how I can run install file?
the cftest.php run smoothly but I can't install. Don't know why
Just in case you missed it ;) This is the TinyPortal support forum, not Coppermine support forum.
So if you run into problems with coppermine installs or mods for coppermine, i suggest you seek help on their support forum. A big possibility is that the help you need are allready there to in writing in the CPMFetch support thread.
thank guys,
Although I not be able to control its look and its location when click on the image, fnally, cpmfetch run in my tinyportal block
everytime when I click on a random image,fetched from coppermine gallery to front page, a new window with coppermine gallery pop up. Is there anyway or code for use to allow you to go to the coppermine gallery framed in SMF without new pop-up window
thanks
Read through this thread, or use the search, the answer is here some where
Hi G6,
I read the whole thread twice. I knew someone ask the same question but no answer or solution yet. So I re-ask the question in case some one can update the answer.
My working site: www.kientruc.info
Quote from: auvn on December 15, 2006, 03:36:18 AM
everytime when I click on a random image,fetched from coppermine gallery to front page, a new window with coppermine gallery pop up. Is there anyway or code for use to allow you to go to the coppermine gallery framed in SMF without new pop-up window
thanks
You would have to edit the coppermine files to change that behavior.. Perhaps CPM fetch. Not sure which but I would ask on the coppermine boards to see if someone there knows.
Did anyone figure out how to have the random photo open coppermine inside tp when clicked? It brings me to
http://www.ligs.us/Coppermine/displayimage.php?pos=-5
instead of
http://www.ligs.us/smf3/index.php?action=coppermine
thanks
Nope... But if you figure it out let us know because there are many coppermine users here that would like to know how.. ;D
lol Ill do my best but dont hold your breath im not to bright :2funny:
There is supposed to be a setting in CPMFETCH that allows the change of the url. Not sure if it is for the target url or what as I have never seen it actually work or a working example of it.
I have worked with it a bit but haven't figured it out yet.
Yea I have been reading alot gave up tonight my eyes hurt
Well i found the imagelink command that allows you to make it so the image DOES NOT link at all. Then you can ad a link to the bottom of the pic that will open the gallery correctly.
So far it is the best I have found.
do you mean
$cpg_include_link=0;
where do you add it ?
I could not get the picture not to be a link
im using
print "A random selection from our Gallery:<CENTER>";
include "../smf3/cpmfetch.php";
$objCpm = new cpm("/Coppermine");
$objCpm->cpm_viewRandomMedia(1,5);
$objCpm->cpm_close();
print "</center>";
Oh wow you have a lot of reading to do yet... :2funny:
I'll show you what I use... It's using some of the other arrays since I cannot put all the pics I have on the "front page" if ya know what I mean. But here is the code I use and a brief run down of what it does...
print "<center>";
include "../cpmfetch_directory/cpmfetch.php";
$objCpm = new cpm("/galleryfolder");
$objCpm->cpm_viewRandomMediaFrom(1,1,$source = "cat=2:album=32,40,42,44",array("imagesize" => "int","imageheight" => "300","imagewidth" => "400","windowtarget" => "_new","imagelink" => "none","alttag" =>"From Album: %a Added: %w"));
$objCpm->cpm_close();
echo '<a href="the proper link to your gallery inside SMF"> Click here to view the Gallery</a>';
print "</center>";
Alright now I am pulling images from one category and 4 albums for display. I have the width and height hardcoded to fit no matter what and it always pulls the intermediate image. In the array you will see the image link command and some code I added for the link to the gallery.
Works pretty good for me and I am happy with it at this point. Keep reading the documentation as it has a lot of good info in it.
You can see the above code at http://www.southsidestreetcars.org
Thanks I will start again fresh tomorrow
Thanks that will work just fine :up:
Glad I could help you out.. ;D
omg.. i need something like that to have a one rangom image block and one latest 3 images block both from coppermine, but i can't install fetch, i dunno why, ther's a simple code to use in a couple PHP block to have these results?
i can pm who can hel me telling him the name of the directory and whatever else he could need to modify the code to my needs.. please :|
I've installed cpmfetch and looks like it worked during the install.php (I saw the image)
I pasted the supplied code into a PHP block:
<?php
include "../gallery/cpmfetch/cpmfetch.php";
$objCpm = new cpm();
$objCpm->cpm_viewLastAddedMedia(1,4);
$objCpm->cpm_close();
?>
but I get php errors. :(
My directory structure:
\root
\root\bforum (main smf and TP folder)
\root\gallery (main cmg folder)
\root\gallery\cpmfetch (cpmfetch folder)
anyone know what I'm doing wrong here?
If you use a PHP block you must NOT use the php tags <?php ?> Remove the tags from the code and try again :)
ok thanks for that tip...
I get this error msg "Random Image Error: config file not specified and default not found - did you run the install program?"
any ideas?
Try this instead
include "../cpmfetch/cpmfetch.php";
$objCpm = new cpm('/gallery');
$objCpm->cpm_viewLastAddedMedia (1,8,array("imagesize" => "Thumb","imageheight" => "75","imagewidth" => "75","windowtarget" => "_new","alttag" =>"From Album: %a Added: %w"));
$objCpm->cpm_close();
It didnt work either so I tried to change the url to ../gallery/cpmfetch/cpmfetch.php but no luck either:
Error: config file /gallery specified but was not found.
I'm pointing it to the right director right?
root/gallery/cpmfetch
root/bforum
the script is called within /root/bforum isnt it? so ../gallery/cpmfetch should go back one directory and then enter the gallery/cpmfetch folder?
What does the $objCpm = new cpm('/gallery'); refer to?
I did the process showed by Carver but it shows me this:
Parse error: syntax error, unexpected '<' in /home/.lexy/warhammer/warhammer.clans.it/community/Sources/Load.php(1708) : eval()'d code(35) : eval()'d code on line 1
what've i to do?
I converted a bit the code in the first post.
It shows random picture, excluding movies.
Thumbs title is album and picture name.
Clicking on it will point to bigger picture in the gallery.
Just put it in the php block.
Tested on SMF 1.1.1, TP 0.9.7, bridged CPG 1.4.10,
Only thing needed to set is the cpg prefix and gallery path
$gallery_path = "../gallery"; // no slash '/' at the end. Usually "../gallery"
$gallery_prefix = "cpg_"; // cpg mysql tables prefix. Usually "cpg_"
$result = mysql_query("SELECT filename,filepath,aid,pid,title FROM " . $gallery_prefix . "pictures
WHERE approved='YES'
AND (filename LIKE '%.jpg'
OR filename LIKE '%.jpeg'
OR filename LIKE '%.gif'
OR filename LIKE '%.png')
ORDER BY RAND() DESC LIMIT 1");
$row = mysql_fetch_array($result);
mysql_free_result($result);
$filename = 'thumb_' . $row['filename'];
$filepath = $row['filepath'];
$aid = $row['aid'];
$pid = $row['pid'];
$title = $row['title'];
$result = mysql_query("SELECT aid,title FROM " . $gallery_prefix . "albums
WHERE aid = " . $aid);
$row = mysql_fetch_array($result);
mysql_free_result($result);
$album = $row['title'];
echo '<div align="center"><a href="' . $gallery_path . '/displayimage.php?pos=-' . $pid .'"><img src="' . $gallery_path . '/albums/' . $filepath . $filename .'" border="0" title ="' . $album . ' - ' . $title . '"></a><br></div>';
I am using the codes below for Random photos:
Quoteecho "<CENTER>";
chdir("../gallery/cpmfetch/");
include "cpmfetch.php";
$objCpm = new cpm();
$objCpm->cpm_viewRandomMedia(2,1);
$objCpm->cpm_close();
chdir("../../");
echo 'View Gallery (http://pentaxworld.com/gallery)';
echo "</center>";
I want to create another block for Latest Photos, using the codes below:
Quoteecho "<CENTER>";
chdir("../gallery/cpmfetch/");
include "cpmfetch.php";
$objCpm = new cpm();
$objCpm->cpm_viewLastAddedMedia(1,1);
$objCpm->cpm_close();
chdir("../../");
echo 'View Gallery (http://pentaxworld.com/gallery)';
echo "</center>";
However, I can only get one working AT ONE TIME! If I ON/Activate both, then error occurs.
Any idea why and how the codes above should be edited?
My forum is at:
www.PentaxWorld.com (http://www.pentaxworld.com)
Many thanks! :up:
This worked like a charm. Thanks, Bud!
Quote from: gerrymo
print "A random selection from our Gallery:<CENTER>";
include "../cpmfetch/cpmfetch.php";
$objCpm = new cpm("/cpg");
$objCpm->cpm_viewRandomMedia(1,5);
$objCpm->cpm_close();
print "</center>";
(Line 4 denotes 1 row of 5 photos)
My host Cpanel has Fantastico and it appears will automatically install Coppermine. What would be left for me to do?. Just create a script block and put a script in it?.
Thanks
I think you need to bridge it into SMF first, but im not 100% sure there.
Hello
I'm still a newb and after reading this entire thread, didn't feel i was ready to tackle this yet. But was praying Fantastico would take care of all that for me :D
Quote from: edifier on February 27, 2007, 07:05:08 PM
Hello
I'm still a newb and after reading this entire thread, didn't feel i was ready to tackle this yet. But was praying Fantastico would take care of all that for me :D
You can install via Fanstatisco, but later you still need to bridge it to your SMF so that it uses one user database.
You can check my forum at www.PentaxWorld.com for example of how I integrated both into one ;)
I installed cpmFetch in a subdir of coppermine, made a php block with this code in it,
include_once"/local/web/coppermine/cpmfetch/cpmfetch.php";
$objCpm = new cpm("/local/web/coppermine/cpmfetch/cpmfetch_config.php");
$options = array('windowtarget'=>'_blank',"imageattributes" => array("width" => "120")");
echo '<div align="center">';
$objCpm->cpm_viewRandomMediaFrom("cat=8,2,3",1, 1,$options);
echo '</div>';
This give me a random centered thumb with a width of 120 px.
On another part of my site I want to display the last images that are uploaded. Now I run into trouble because cpm cannot be redeclared.
I think the best is to put the include and declare statement in for instance the index.template.php and to put the rest in the different blocks on my site.
Anyone done this?
I created TWO php blocks, one with random photos and one with latest photos.
Below are the codes that I use:
Latest Photos:
echo "<CENTER>";
chdir("../gallery/cpmfetch/");
include "cpmfetch.php";
$objCpm = new cpm();
$objCpm->cpm_viewLastAddedMedia(1,5,array("imageheight" => "75"));
$objCpm->cpm_close();
chdir("../../");
echo '<a href="http://pentaxworld.com/gallery">View Gallery</a>';
echo "</center>";
Random Photos:
echo "<CENTER>";
chdir("../gallery/cpmfetch/");
include "cpmfetch.php";
$objCpm = new cpm();
$objCpm->cpm_viewRandomMedia(1,5,array("imageheight" => "75"));
$objCpm->cpm_close();
chdir("../../");
echo '<a href="http://pentaxworld.com/gallery">View Gallery</a>';
echo "</center>";
However, Only Latest Photos are shown, and Random Photos have error with:
Error: config file not specified and default not found - did you run the install program?
How should I correct this? :-\
that is something you need to ask on coppermine gallery forum.
hello
Just have a question I have coppermine random pictures on my center block as php.
How can ı make all the pictures same size or frame it so they are all uniform I really did not see an direct answer to this. site http://ampmnet.net
Thank you
Again something you need to ask on Coppermine forum as it's their code used.
G6 Thank you
but your answer is not what I am looking for.
İf under these conditions I ask coppermine people they will say the very same thing and turn me around to TP.
I am using TP block, using a code designed for it and with those I am calling pictures so the real coding is on our side.
and all works just need to get the pictures in order so they look decent, I am sure there is a code here somewhere that may do just that.
maybe you can direct me to a section where I may search for it.
thank you again
Quotejust need to get the pictures in order so they look decent
I really wish i could given you a better answer, and i AM sorry for the Coppermine site to send you her even if they should know better by now that TP not SMF have any image handling tools builded in like the Coppermine script have.
The image engine is their work with in coppermine, (and offcourse the server you are on need to have support for it)
But TP itself have no such thing as an image handler for resize or crop images to fit blocks or articles.
You will have to use some sort of external script to gain what you want. And i really do think Coppermine knows this a lot more then we do here :-\
Hi - I can see it has been asked in this thread but I couldnt see a solution yet..
When someone clicks on the image (thumbnail) in tinyportal block, it loads coppemine without tinyportal header/footer etc (not wrapped)
Is there a solution for this or would it be to do with cpmfetch?
Quote from: SteveW on April 22, 2007, 10:39:37 PM
Hi - I can see it has been asked in this thread but I couldnt see a solution yet..
When someone clicks on the image (thumbnail) in tinyportal block, it loads coppemine without tinyportal header/footer etc (not wrapped)
Is there a solution for this or would it be to do with cpmfetch?
I am having the same problem. When someone click on the image in my TP front page, it link to a double // in Coppermine Gallery, resulting the header of my Gallery not shown.
Eg.
Correct --> http://pentaxworld.com/gallery/index.php
Incorrect --> http://pentaxworld.com/gallery//index.php
Anybody knows how to correct this? The double // is causing the problem.
Quote from: khoking on April 24, 2007, 06:10:29 AM
I am having the same problem. When someone click on the image in my TP front page, it link to a double // in Coppermine Gallery, resulting the header of my Gallery not shown.
I would say that is a CPMfetch issue in the config file. Check the paths in the config file and remove the / and retry?
Quote from: SteveW on April 24, 2007, 06:31:31 PM
I would say that is a CPMfetch issue in the config file. Check the paths in the config file and remove the / and retry?
Thanks SteveW! You are right! There is // in the cpmfetch_config file. I edited and reupload the file and the random images are pointing to the correct URL without the // now.
Many thanks for the great help and support! O0
Trying to use this from the org code on the first post to exclude my own personal gallery.
AND aid <> 111 and owner_name='Carver'
In the URL, it looks like the gallery number is ?cat=10002
It that the right number? It doesn't seem to be excluding the photos.
Thanks
how to make the randoms photos from coppermine to show vertically instead of horizontally.
Hi,
here's my little Block Code. It opens an Album inside the Portal after clicking the Link in the Block.
echo "<CENTER>";
chdir("../coppermine/cpmfetch/"); //Inset Path to Your CPMFETCH Dir here!
include "cpmfetch.php";
$objCpm = new cpm();
$objCpm->cpm_viewRandomMedia(1,1,array("imageheight" => "100"));
$objCpm->cpm_close();
chdir("../../");
global $context, $settings, $options, $scripturl, $txt;
$current_action = 'home';
if (in_array($context['current_action'], array( 'gallerie')))
$current_action = $context['current_action'];
$current_action == 'gallerie' ? 'active_back' : 'back';
echo ' <a href="', $scripturl, '?page=Coppermine%20Galerie">Enter Gallery</a> '; //Open Coppermine standalone in Your Browser and insert the String after "?page=" which is pointing to Your Album
echo "</center>";
regards,
Mintschi
Quote from: fangweile on June 08, 2007, 05:39:38 AM
how to make the randoms photos from coppermine to show vertically instead of horizontally.
cpm_viewRandomMedia(1,1 <= the first 1 is the number of rows, the second 1 is the number or columns ... 1,4 gives you one row with four pictures, 4,1 gives you one column with four pictures
This code works for me just fine as far as displaying the pictures and no errors in the log.
echo "<CENTER>";
chdir("../gallery/cpmfetch/");
include "cpmfetch.php";
$objCpm = new cpm();
$objCpm->cpm_viewRandomMedia(1,6,array("imageheight" => "75"));
$objCpm->cpm_close();
chdir("../../");
echo '<a href="http://www.mysite.com/forum/index.php?action=forum">View Gallery</a>';
echo "</center>";
However, I get 16 debug errors half related to TP and the other to SMF. I am using the 'Errors On Top' modification, which shows me that information. Anyone have this mod who sees this same 'debug' message? Any harm if I ignore it :2funny:
Otherwise, it pulls in the pictures just fine. :up:
I'm on CPG 1.4.12 with CPMfetch 2.0.0 on SMF 1.1.3 TP .0983
Not sure if someone already did this example...
I always want to click on the random coppermine thumbnail image which I generated to see the full size image.
Here is my code which I tweaked... jpg files only..... and put inside a left or right php block. It may be optimal to include the sql connection info from an external file instead; for security reasons.. but I left it all here to see.
$result1 = @mysql_connect('localhost', 'username', 'PASSWORD');
$result1 = mysql_query("SELECT filename,filepath from cpg1_pictures where filename like \"%.jpg\" or (filename like \"%.jpeg\") ORDER BY RAND() LIMIT 1") ;
$row1 = mysql_fetch_array($result1);
mysql_free_result($result1);
$filename1 = 'thumb_' . $row1['filename'];
echo '<div align="center"><a href="http://somewebsite.com/cpg/albums/' , $row1['filepath'] , $row1['filename'] , '" target="new"><img src="http://somewebsite.com/cpg/albums/' , $row1['filepath'] , $filename1 , '" alt="Random Photo"/></a></div>';
After reading this thread and some others like it I thought I would share what I learned. CPMFetch is great; unfortunately the way in which CPG integrates with SMF/TP (iframe) it is difficult to get the thumbnail to link properly.
As an alternative I have seen people ask how to stop the thumbnail from linking entirely.
Here is how you do that:
echo '<center>'; include_once "./gallery/cpmfetch/cpmfetch.php";
$options = array( 'imagelink' => 'none' );
$objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewRandomMedia(1,1,$options);
$objCpm->cpm_close();
echo '</center>';
Note line 2 and line 4. This is the code within your block.
I personally have setup for my off-road site, thumbnail link off and a link to my gallery under the thumb.
Here is the code I used for that:
echo '<center>'; include_once "./gallery/cpmfetch/cpmfetch.php";
$options = array( 'imagelink' => 'none' );
$objCpm = new cpm("./gallery/cpmfetch/cpmfetch_config.php");
$objCpm->cpm_viewRandomMedia(1,1,$options);
$objCpm->cpm_close();
echo '<a href="http://www.maine4x4.org/community/index.php?action=Coppermine">View Gallery</a>';
echo '</center>';
Using the linktemplate option you can specifically or dynamically set the output link URL. More information can be found on this in the documentation.
The author of this script is great and included a ton of options and features. All of which you can find in the extensive documentation that he provides.
Here (http://"http://cpmfetch.fistfullofcode.com/docs/stable_advanced/index.html")
More specifically information on the $options call can be found:
Here (http://"http://cpmfetch.fistfullofcode.com/docs/stable_advanced/cpmfetch/tutorial_explainations.optionsarray.pkg.html%20")
I hope this has helped some!
Quote from: RoarinRow on August 22, 2007, 01:44:36 AM
This code works for me just fine as far as displaying the pictures and no errors in the log.
echo "<CENTER>";
chdir("../gallery/cpmfetch/");
include "cpmfetch.php";
$objCpm = new cpm();
$objCpm->cpm_viewRandomMedia(1,6,array("imageheight" => "75"));
$objCpm->cpm_close();
chdir("../../");
echo '<a href="http://www.mysite.com/forum/index.php?action=forum">View Gallery</a>';
echo "</center>";
However, I get 16 debug errors half related to TP and the other to SMF. I am using the 'Errors On Top' modification, which shows me that information. Anyone have this mod who sees this same 'debug' message? Any harm if I ignore it :2funny:
Otherwise, it pulls in the pictures just fine. :up:
I'm on CPG 1.4.12 with CPMfetch 2.0.0 on SMF 1.1.3 TP .0983
Thank you,
RoarinRow! only this code is worked on all my bundles TP(.0983) + SMF(1.1.4) + CPG(1.4.10/1.4.14) with CPMfetch 2.0.0...
I used Mod
'Errors On Top' one year ago during a few days, then I removed it - one half of meter 'debug' messages they were not greatly pleased to me (sorry my bad english ;-)).
Agree with Stern. Thanks RoarinRow, worked perfect and was exactly what I was looking for.
SMF 114, TP 983, CPG 114
/JOOM
Quote from: RoarinRow on August 22, 2007, 01:44:36 AM
This code works for me just fine as far as displaying the pictures and no errors in the log.
echo "<CENTER>";
chdir("../gallery/cpmfetch/");
include "cpmfetch.php";
$objCpm = new cpm();
$objCpm->cpm_viewRandomMedia(1,6,array("imageheight" => "75"));
$objCpm->cpm_close();
chdir("../../");
echo '<a href="http://www.mysite.com/forum/index.php?action=forum">View Gallery</a>';
echo "</center>";
However, I get 16 debug errors half related to TP and the other to SMF. I am using the 'Errors On Top' modification, which shows me that information. Anyone have this mod who sees this same 'debug' message? Any harm if I ignore it :2funny:
Otherwise, it pulls in the pictures just fine. :up:
I'm on CPG 1.4.12 with CPMfetch 2.0.0 on SMF 1.1.3 TP .0983
This one works fine for me too. Using smf 1.1.4, Tinyportal 0.9.8, Coppermine 1.4.13 and Coppermine fetch 2.0.0
I've put it in a php article. Thanks for sharing it. See here. http://cameracraniums.com
Any way of adding this to an existing article at the top of it, and keeping my welcome message etc intact? I'm very new to this sort of stuff and haven't a clue about php / html etc. Also how do I get it to show the latest uploaded pics?
This displays a random images and then the latest image @ 120px
[random]
[latest]
[View Gallery]
echo "<CENTER>";
chdir("../gallery/cpmfetch/");
include "cpmfetch.php";
$objCpm = new cpm();
$objCpm->cpm_viewRandomMedia(1,1,array("imageheight" => "120"));
$objCpm->cpm_close();
$objCpm = new cpm();
$objCpm->cpm_viewLastAddedMedia(1,1,array("imageheight" => "120"));
$objCpm->cpm_close();
chdir("../../");
echo '<a href="http://www.jordan.thecelebvenue.com/gallery">View Gallery</a>';
echo "</center>";
Cool, I'm glad it worked for you all. Sorry for the late response, I've been super super busy at work :o Plus I recently went through a server move :uglystupid2:
Here's something odd. When I have a "Copperminefetch" block and a "SMF Gallery Random Picture" block on the front page at the same time the SMF GRP block does not display, and displays this error:
MySQL error:Can't connect to local MySQL server through socket '/usr/local/mysql-5.0/data/mysql.sock' (2)
The error goes away when I remove the Copperminefetch block. I'd like to have both boxes on the page at the same time, but what do I need to do? I posted this same question on the SMF GRP block snippit area and was recommended to ask here. Thanks in advance for any help.
Here's the link. www.remedydog.com
Have you edit the settings in your cpmfetch so they point to the correct location on your server and path ?
I installed cpmfetch just as directed. Everything seemed to go well. This snippit seems to work. It looks like some kind of conflict between the two, (coppermine fetch block and smf gallery block) like they're trying to fetch photos at the same time or something causing the error. What should the setting be and where would I make the changes. Thanks alot.
hmm it all depends.. :o
what version of smf and tp are you using? link to your site, and the errors in error log, etc.. might get better help that way.. ;)
smf 1.1.5
TinyPortal 1.0.5 beta
Coppermine 1.4.18
Cpmfetch 2.0.0
www.remedydog.com
Here are two error logs:
"Solved""2: mysql_query() [<a href='function.mysql-query'>function.mysql-query</a>]: A link to the server could not be established
File: /home/content/j/u/m/html/forums/Themes/default/TPortal.template.php (tp_below sub template - eval?)
Line: 176:"
"Solved" 8: Undefined property: cpm::$ AND ( p.filename like '%.jpg' OR p.filename like '%.JPG' OR
File: /home/content/j/u/m/html/coppermine/cpmfetch/cpmfetch_dao.php
Line: 182"
Thank you very much for the help.
Edited: 2nd error solved. Here's the fix: http://forum.coppermine-gallery.net/index.php/topic,53647.0.html
Edited: 1st error solved. Used this code in snip it block: Its a smf gallery snip it global $scripturl, $db_prefix, $modSettings, $boardurl;
echo '<div align="center"><marquee scrollamount="1" scrolldelay="20" direction="left" loop="true" width="80%" onmouseover=\'this.stop()\'onmouseout=\'this.start()\'>';
if(empty($modSettings['gallery_url']))
{
$modSettings['gallery_url'] = $boardurl . '/gallery/';
}
$request = db_query("SELECT thumbfilename, ID_PICTURE, title, ID_MEMBER FROM {$db_prefix}gallery_pic GROUP BY thumbfilename ORDER BY RAND() LIMIT 20" , __FILE__,__LINE__);
while ($row = mysql_fetch_assoc($request))
{
$request_name = db_query("SELECT memberName FROM {$db_prefix}members WHERE ID_MEMBER LIKE '{$row['ID_MEMBER']}'", __FILE__, __LINE__);
$row_name = mysql_fetch_assoc($request_name);
$alt_text = $row['title'] . " by " . $row_name['memberName'];
echo ' <a href="', $scripturl, '?action=gallery;sa=view;id=', $row['ID_PICTURE'], '"><img alt="' , $alt_text , '" src="', $modSettings['gallery_url'] . $row['thumbfilename'] ,'" /></a>';
mysql_free_result($request_name);
}
echo '</marquee></div>';
mysql_free_result($request);
Thanks.
I was wondering if there was a definitive way to display this yet? I have embedded the code in a html file and used a html block to call it, but nothing appears at all. No error message either.
It is not HTML code, it is PHP code. It must therefor be processed in a PHP file, article, or Block.
Do this works with a CPG installation in another domain, but same server?!
If your host allows you to include the config file from your other server, and you're allowed to connect to the other database, I don't see why it wouldn't work. You'll have to check with your host to see if they allow it if it doesn't wrok.