View Full Version : PHP Image Generation
fileserverdirect
04-26-2008, 03:20 AM
Hello all!
I was just wondering how DD had it's "RSS Button maker" and the "Gradent image" tool was made. I did a google search and got a few results, but non actually showing how you program this. Does anyone know a script\website that can explain how to do this (Or maybe you know??).
Thanks,
thetestingsite
04-26-2008, 03:23 AM
Check out the GD image functions from the php documentation:
http://www.php.net/manual/en/ref.image.php
Hope this helps.
fileserverdirect
04-26-2008, 03:51 AM
Thanks, but one more question:
I am using this script from php.net:
<?php
function LoadPNG($imgname)
{
$im = @imagecreatefrompng($imgname); /* Attempt to open */
if (!$im) { /* See if it failed */
$im = imagecreatetruecolor(150, 30); /* Create a blank image */
$bgc = imagecolorallocate($im, 255, 255, 255);
$tc = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 150, 30, $bgc);
/* Output an errmsg */
imagestring($im, 1, 5, 5, "Error loading $imgname", $tc);
}
return $im;
}
header("Content-Type: image/png");
$img = LoadPNG("bogus.image");
imagepng($img);
?>
and I want to write text ontop of the image that I imported. How can I do this? Also, could ths work as "Dynamic Text" such as change it to a certain uploaded font or automaticly add a filter to the text, e.g. shadow, glow etc?
djr33
04-26-2008, 08:25 AM
Generally look through the functions on that page and take some time to get used to them. The explanations are complex and tedious, but generally the GD library is a pain anyway-- lots of potential, but awkward to use, and it also is very slow and taxing on the server.
imagestring() writes text.
As for a glow, that's getting more complex. You can try to calculate one yourself or use one of the built in filters with imagefilter().
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.