"nod to GeorgeCC for the Code"
This can be used on any forum that uses either img or html, and thats quite a few, this generates a HUGE amount of hits for my galleries.
Tested with 1.3.2 and 1.3.5 1.4.2 and 1.4.3
Upload to the root of your gallery.
copy this text and save it... using notepad...as pic.php
<?php
define('IN_COPPERMINE', true);
define('INDEX_PHP', true);
require('include/init.inc.php');
header('content-type: image/jpeg');
$mlink=mysql_connect('localhost','your gallery Database', 'your password');
mysql_select_db('your gallery database', $mlink);
$sum_x=4;
$pos=4;
if(isset($_GET['q'])) {
$q=$_GET['q'];
} else {
$q=3;
}
if(isset($_GET['alb'])) {
$pics=mysql_query("select filepath, filename from cpg_pictures where aid=".$_GET['alb']." and pwidth>0 order by rand() limit 0,$q");
} else {
$pics=mysql_query("select filepath, filename from cpg_pictures, cpg_albums where cpg_albums.aid=cpg_pictures.aid and pwidth>0 and visibility=0 order by rand() limit 0,$q");
}
if(isset($_GET['txt'])) {
$txt=$_GET['txt'];
} else {
$txt="www.yourwebsiteurl.com";
}
while($pr=mysql_fetch_array($pics)) {
$fname[]="albums/".$pr['filepath']."thumb_".$pr['filename'];
list($width, $height, $type, $attr) = getimagesize("albums/".$pr['filepath']."thumb_".$pr['filename']);
$sum_x+=$width+4;
$ix[]=$width;
$im[]=imagecreatefromjpeg("albums/".$pr['filepath']."thumb_".$pr['filename']); //echo "albums/".$pr['filepath']."thumb_".$pr['filename']."--";
}
$im_total = @imagecreatetruecolor($sum_x, 128);
for($pn=0; $pn<$q; $pn++) {
imagecopy($im_total, $im[$pn], $pos, 4, 0, 0, $ix[$pn], 120);
$pos=$pos+$ix[$pn]+4;
}
$pos=$pos-$ix[$pn]-4;
//imagecopy($im_total, $im[1], $pos, 4, 0, 0, $ix[1], 120);
//$pos=$pos+$ix[1]+4;
//imagecopy($im_total, $im[2], $pos, 4, 0, 0, $ix[2], 120);
$textcolor = imagecolorallocate($im_total, 255, 255, 255);
$last_x=max($pos,168);
imagefilledrectangle($im_total, $last_x-168, 111, $last_x+2, 126, 0);
imagestring($im_total, 4, $last_x-166, 111, $txt, $textcolor);
imagejpeg($im_total);
?>
note the parts that need editing at the top and your website url.
next .htacess
RewriteEngine on
RewriteRule ^([^/\&\?]*)pic\.jpg$ pic.php?$1
RewriteRule ^([^/\&\?]*)pic([0-9]*)\.jpg$ pic.php?alb=$2
RewriteRule ^([^/\&\?]*)pic([0-9]*)/([0-9]*)/(.*)\.jpg$ pic.php?alb=$2&txt=$4&q=$3
RewriteRule ^([^/\&\?]*)pic([0-9]*)/(.*)\.jpg$ pic.php?alb=$2&txt=$3
copy and save this as .htaccess
the code worlks like this...
http://www.mess-hall.co.uk/gallery/pic.jpg - this one pulls images from ALL the albums at random.
or
http://mess-hall.co.uk/gallery/pic68.jpg(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fmess-hall.co.uk%2Fgallery%2Fpic68.jpg&hash=7d229ff0bd52e6115402018aec250ecb180976d0)
or
http://www.mess-hall.co.uk/gallery/pic.jpg(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fmess-hall.co.uk%2Fgallery%2Fpic60.jpg&hash=e30e90987a5b58bb2eadb09c83bf5a0fe9060448)
the number after pic## is the number of the album you want.
by default, the code chooses 3 pics, but you can select as many or as few as you want.
And change the text inline.
like this
http://mess-hall.co.uk/gallery/pic68/5/Dazbobaby.com.jpg(https://forum.coppermine-gallery.net/proxy.php?request=http%3A%2F%2Fmess-hall.co.uk%2Fgallery%2Fpic68%2F5%2FDazbobaby.com.jpg&hash=74696a80d4a15a1ebf68a93c65a55170db5723a9)
Notice that this time i have included the url at the end, this can be whatever you want. If your text doesnt fit you will need to adjust some of the code, found at the bottom of pic.php.
Also change all the 120's to what ever your default thumbnail size it, if its 50, change them from 120 to 50, but you will need to adjust the postion of the text for your url, I didnt write the code, so i cant tell you how to do this, just play around.
Now Works with 1.4* too.
Updated: Urls were completely out of date.
All working now.