Store
Community Documentation

v3 Knowledgebase

Forum Signature last upload photo

With this script you can show in (other) Forum Software works with BBCode your last uploaded Photo.

Privacy is respected and only displayed publicly tagged photos.

You have to add a .htaccess to the Directory the script is located.

.htaccess
Quote:

RewriteEngine on
RewriteRule ^(.+)\.png$ new5.php?&user=$1 [L,QSA]


mysql_connect.php //
Quote:

<?php
$mysqlhost="localhost"; // MySQL-Host
$mysqluser="xxx"; // MySQL-User
$mysqlpwd="xxx"; // Password
$mysqldb="xxx"; // DB Name
?>


new5.php
Quote:

<?php
$uebergabe = $_GET['user'];
$userid = $uebergabe; // Wert zuweisen




include "mysql_connect.php" ;

$wurzel = "http://www.DOMAIN.com/file/pic/photo/";


// connect DB
$connection=mysql_connect($mysqlhost, $mysqluser, $mysqlpwd) or die ("Verbindungsversuch fehlgeschlagen");
mysql_select_db($mysqldb, $connection) or die("Konnte die Datenbank nicht waehlen.");


// SQL-Query
$sql = "SELECT user_id, photo_id, destination, time_stamp FROM phpfox_photo WHERE user_id =" . $userid . " and privacy < 2 ORDER BY time_stamp DESC limit 0,5";
$result = mysql_query($sql) or die("Anfrage nicht erfolgreich");
$anzahl = mysql_num_rows($result);

while ($row = mysql_fetch_array($result)) {

$path =$row[2] ;
$path = str_replace("%s", "_100", $path);

$newarray[] = $wurzel .$path;

// Image Erstellung

Header("Content-Type: image/png");

$im = @imagecreatetruecolor(460, 110) or die("Cannot Initialize new GD image stream");
$uploader = "My last Pic upload at DOMAIN.com";
$copyr = "(c)2012 ThLord";
$version = "Version: 0.4";
$background_color = imagecolorallocate($im, 0, 0, 0);
$version_color = imagecolorallocate($im, 66, 111, 178);
$text_color = imagecolorallocate($im, 255, 255, 0);
imagestring($im, 5, 50, 5, $uploader, $text_color);
imagestring($im, 2, 370, 95, $copyr, $version_color);
imagestring($im, 1, 10, 98, $version, $version_color);

$gaimage1 = imagecreatefromjpeg ($newarray[0]); //das erste Bild einlesen
$w = imagesx($gaimage1);
//$h = imagesy($gaimage1);
$h = 65;
$gaimage2 = imagecreatefromjpeg ($newarray[1]);
$gaimage3 = imagecreatefromjpeg ($newarray[2]);
$gaimage4 = imagecreatefromjpeg ($newarray[3]);
$gaimage5 = imagecreatefromjpeg ($newarray[4]);

imagecopy($im, $gaimage1, 10, 25, 20, 10, $w, $h);
imagecopy($im, $gaimage2, 100, 25, 20, 10, $w, $h);
imagecopy($im, $gaimage3, 190, 25, 20, 10, $w, $h);
imagecopy($im, $gaimage4, 280, 25, 20, 10, $w, $h);
imagecopy($im, $gaimage5, 370, 25, 20, 10, $w, $h);

imagepng($im);
imagedestroy($im);
?>



edit $uploader text
Please let stand my copyright

You can show it in browser like http://www.DOMAIN.com/signature/new5.php?&user=1
You have to edit the ?&user=xxx - the No. of users Photo you want to show.

In BBCode you have to write to your signature
[#URL=http://www.DOMAIN.com/][#img]http://www.DOMAIN.com/PATHfromSCRIPT/1.png[/img][/URL]
1.png = UserID.png.
without # before #URL and #img

Exsample: