Jump to content

Image and split mysql results to display in php


adzie

Recommended Posts

Hello all,

 

Building a dynamic signature for my forums, fairly simple... or so I thought!

 

Sorry for posting this here but thought it was probably the most applicable forum.

 

I get the image displayed, the db results show exactly how and where I want them, great.  Now to complicate things I want to put images on the image dependant on what groups the user belongs to.  To further complicate things the DB inherited shows the groups in one field as 1:2:3:4 where each number is a group.

 

Below is the code so far, if I set $groups to equal the field results of 1:2:3:4 how can I get that to show them as individual images so 1 = group1.gif 2 = group2.gif etc and then overlay those images over the main image.

 

code below, any suggestions to improve the script or the way to hold multiple group values in once field appreciated!

 

<? 
error_reporting(E_ALL);
ini_set('display_errors', 1);

$query  = "SELECT * FROM users WHERE name='adzie'";
$result  = mysql_query($query);
$user22 = mysql_fetch_row($result);

$group = "Forum User";
$name = "$user22[2]";
$title = "$user22[1]";

header("Content-type: image/gif"); 
$calc = $groups; 
$im = imagecreatefromgif("signature.gif"); 
$color = imagecolorallocate($im, 0,12,47); 
$txt = (imagesx($im) - 46 * strlen($calc)) / 2; 
$txt1 = (imagesx($im) - 46 * strlen($calc)) / 2; 
imagestring($im, 3, $txt, 15, $name, $color); 
imagestring($im, 3, $txt1, 25, $title, $color); 
imagegif($im); 
imagedestroy($im); 
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.