By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,614 Members | 1,653 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,614 IT Pros & Developers. It's quick & easy.

Dynamic Image?

P: n/a
Who knows how this is done:

http://www.danasoft.com/vipersig.jpg

As you can see the signature is dynamical, it uses gdlib I assume and php.
But does anybody have any code for this? Please help me find this, I
allready searched alot, but can't seem to find anything yet...

Regards, Cybex
Jul 16 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Cybex wrote:

Who knows how this is done:

http://www.danasoft.com/vipersig.jpg

As you can see the signature is dynamical, it uses gdlib I assume and php.
But does anybody have any code for this? Please help me find this, I
allready searched alot, but can't seem to find anything yet...

Regards, Cybex


ImageMagick would work well for this, if it's installed on your server.
If you have Telnet or SSH:
whereis ImageMagick
will tell you where it is.

Shawn
--
Shawn Wilson
sh***@glassgiant.com
http://www.glassgiant.com
Jul 16 '05 #2

P: n/a

"Cybex" <cy*************@home.nl> wrote in message
news:bi**********@news1.tilbu1.nb.home.nl...
Who knows how this is done:

http://www.danasoft.com/vipersig.jpg

As you can see the signature is dynamical, it uses gdlib I assume and php.
But does anybody have any code for this? Please help me find this, I
allready searched alot, but can't seem to find anything yet...
PHP to generate a horizontal bar graphic in a PNG file when called with a
URL parameter 'precent'

makepng.php
<?php
// read url parameter 'percent'
$percent=$_GET["percent"];
// calculate size of bar
$x1=floor(460*($percent/100));

// build image
$im = ImageCreate(500, 50);

// set colours, first colour created is background
$black = ImageColorAllocate($im, 0, 0, 0);
$white = ImageColorAllocate($im, 255, 255, 255);
$red = ImageColorAllocate($im, 255, 0, 0);

// set up array defining vertices of hexagonal bar, width depends on
'percent' parameter
$points=array(10,25,20,45,($x1+20),45,($x1+30),25, ($x1+20),5,20,5);

// draw polygon using array 'points' and colour red
imagefilledpolygon($im,$points,6,$red);

// write text on top of bar
imagestring($im,5,20,20,$percent.'%',$white);

// send the image to the browser
header("Content-type: image/png");
ImagePNG($im);

// tidy up
ImageDestroy($im);
?>

and an example of a page using the above code

<html>
<head>
<title>dynamic image</title>
<script type="text/javascript">
function graph(gaugeID)
{
var n=20;
var time=new Date();
var n=time.getSeconds();
n=Math.floor((n*100)/60);

document.getElementById(gaugeID).src='makepng.php? percent='+n;
var temp=setTimeout("VUgauge('gauge1')",1000);
}
</script>
</head>
<body onload="graph('placeholder');">
<img id="placeholder">
</body>
</html>
Regards, Cybex

Jul 16 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.