Hello, the signature from steverobbins
1. new example sig.php
<?php
define('IN_COPPERMINE', true);
define('INDEX_PHP', true);
require('include/init.inc.php');
header('content-type: image/jpeg');
$sum_x=2;
$pos=3;
$q=6;
$totheight = 80;
$pics=mysql_query("SELECT filepath, filename FROM cpg132_pictures, cpg132_albums WHERE cpg132_albums.aid=cpg132_pictures.aid AND pwidth>0 AND pwidth>pheight AND visibility=0 ORDER BY rand() LIMIT 0,$q");
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+2;
$ix[]=$width;
$iy[]=$height;
$im[]=imagecreatefromjpeg("albums/".$pr['filepath']."thumb_".$pr['filename']);
//echo "albums/".$pr['filepath']."thumb_".$pr['filename']."--";
}
$sum_x = $sum_x + 2;
$im_total = @imagecreatetruecolor($sum_x, $totheight);
// create border
$bordercolour = imagecolorallocate($im_total, 0, 30, 255);
imagefilledrectangle($im_total, 0, 0, $sum_x, $totheight, $bordercolour);
// create white background
$backgroundcolour = imagecolorallocate($im_total, 255, 255, 255);
imagefilledrectangle($im_total, 1, 1, $sum_x - 2, $totheight - 2, $backgroundcolour);
// add pictures imagecopy ( resource dst_im, resource src_im, int dst_x, int dst_y, int src_x, int src_y, int src_w, int src_h )
for($pn = 0; $pn < $q; $pn++) {
imagecopy($im_total, $im[$pn], $pos, 3, 0, 0, $ix[$pn], $iy[$pn]);
$pos=$pos+$ix[$pn] + 2;
}
// get some data from the database
$txt_totalhits = 0;
$sql="SELECT hits FROM cpg132_pictures";
$result = mysql_query($sql);
$txt_totalphotos = mysql_num_rows($result);
while ($row = mysql_fetch_array($result, MYSQL_BOTH))
{
$txt_totalhits = $txt_totalhits + $row['hits'];
}
$sql="SELECT aid FROM cpg132_albums";
$result = mysql_query($sql);
$txt_totalalbums = mysql_num_rows($result);
$sql="SELECT msg_id FROM cpg132_comments";
$result = mysql_query($sql);
$txt_totalcomments = mysql_num_rows($result);
//$sql="SELECT aid FROM cpg132_albums";
//$result = mysql_query($sql);
//$txt_totalalbums = mysql_num_rows($result);
// Add text
$textcolor = imagecolorallocate($im_total, 50, 50, 150);
$txt = "Random photos from xxxxxxxxxxxx - $txt_totalphotos photos, $txt_totalhits views, $txt_totalalbums albums, $txt_totalcomments comments.";
imagefilledrectangle($im_total, 2, 64, $sum_x - 2, $totheight - 2, $backgroundcolour);
// bool imagestring ( resource image, int font, int x, int y, string s, int col )
imagestring($im_total, 2, 4, 64, $txt, $textcolor);
imagejpeg($im_total);
?>
!! prefix cpg132_ edit on you prefix !!
2. Upload your server and try it
example my: http://svet.pelhrim.cz/pic.php
3. Now uses php_gd2 - fce: imagestring
1) Not a plugin, as it doesn't use coppermine's plugin API. Moving accordingly.
2) Bound to break if not stored in coppermine's root folder.
3) Why include coppermine's init.inc.php and then hardcode the queries instead of using coppermine's built-in queries?
4) Hard-coded table prefix is bound to break things for most
Although we appreciate your willingsness to share, you should review this mod before it could actually go into the mods board (will be moved again if it actually qualifies as a working mod).
:( that is functional mod ...
works for you, won't work for others. Therefor not moving to mods board. Re-read my advice and do as suggested if you want this to go into the mods section. If you don't care, then leave as-is.