Jump to content

Tanis

Members
  • Posts

    31
  • Joined

  • Last visited

Tanis's Achievements

Newbie

Newbie (1/7)

0

Reputation

  1. <?$x = 0;$text=$_GET["text"];$im = imagecreatetruecolor( 20*strlen($text), 20 );imagealphablending( $im, false );imagesavealpha( $im, true );$col = imagecolorallocate( $im, 0, 0, 0, 127 );imagefilledrectangle( $im, 0, 0, 20*strlen($text), 20, $col );for ($i = 0; $i < strlen($text); ++$i){$letter = $text[$i];$filename = "http://www.habbground.com/goodies/letters/$letter.png";$image = imagecreatefromPNG($filename);imagecopyresampled($im, $image, $x, 0, 0, 0, 20, 20, 20, 20);$x = $x+20;}header('Content-type: image/png');imagealphablending( $im, false );imagesavealpha( $im, true );imagePNG($im);imageDestroy($im);?> There were some issues with images I had too.PS- sorry about the really long delay, I lost my link to the thread
  2. Neither of those worked, but I tried taking out another part, and it's working now!Thanks for all your guys' help!
  3. Sorry, I should have been more clear.After adding in the debug code, I discovered the problem and fixed it.I now get the properly generated text, but the text/image still has the black background.
  4. I added in the transparency code, ending up with <?$x = 0;$text=$_GET["text"];$im = imagecreatetruecolor( 20*strlen($text), 20 );imagealphablending( $im, false );$col = imagecolorallocate( $im, 0, 0, 0, 127 );imagefilledrectangle( $im, 0, 0, 20*strlen($text), 20, $col );imagealphablending( $im, true );for ($i = 0; $i < strlen($text); ++$i){$letter = $text[$i];$filename = "http://www.habbground.com/goodies/letters/$letter.png";$image = imagecreatefromPNG($filename);imagecopyresampled($im, $image, $x, 0, 0, 0, 20, 20, 20, 20);$x = $x+20;}header('Content-type: image/png');imagealphablending( $im, false );imagesavealpha( $im, true );imagePNG($im);imageDestroy($im);?> And it still has a black background.
  5. It should be working... outputting the variables returnedtext: ABCDEletter: Afilename: http://www.habbground.com/goodies/letters/A.pngletter: Bfilename: http://www.habbground.com/goodies/letters/B.pngletter: Cfilename: http://www.habbground.com/goodies/letters/C.pngletter: Dfilename: http://www.habbground.com/goodies/letters/D.pngletter: Efilename: http://www.habbground.com/goodies/letters/E.pngCopy/pasting the links returns an image.
  6. <?$x = 0;$text=$_GET["text"];$im = imagecreatetruecolor( 20*strlen($text), 20 );for ($i = 0; $i < strlen($text); ++$i){$letter = $text[$i];$filename = "http://www.habbground.com/goodies/letters/$letter.png";$image = imagecreatefromPNG($filename);imagecopyresampled($im, $image, $x, 0, 0, 0, 20, 20, 20, 20);$x = $x+20;}header('Content-type: image/png');imagePNG($im);imageDestroy($im);?> Returns a totally black image (varying in size depending on the # of letters inputted).
  7. I know WHY its black, i just need to know how to change it.Although it would be ok if the user could simply input a background color (in hex), it would be much better if there was a way to make the image transparent.
  8. Works now, but how do i change the background color so its transparent instead of black?
  9. hehe, backwards it is...Well now that those two things are fixed, all I'm getting is a black box...http://www.habbground.com/txtst.php?text=ABCDE
  10. Alright, changed it to <?0 = $x;$text=$_GET["text"];for ($i = 0; $i < strlen($text); ++$i){$letter = $text{$i};$filename = "/goodies/letters/$letter.gif";$im = imagecreatetruecolor(20, 20);$image = imagecreatefromGIF($filename);imagecopyresampled($im, $image, $x, 0, 0, 0, 20, 20, 20, 20);$x = $x+20;}header('Content-type: image/gif');imageGIF($im);imageDestroy($im);?> and it doesn't output anything.What am I missing (most likely something really obvious)?
  11. But in imagecopyresampled, $width is in the destniation image width spot, so wouldn't you want the width of the destination img increase by 20 for each additional letter?
  12. So far i've got: <?$width = 20;$height = 20;$text=$_GET["text"];for ($i = 0; $i < strlen($text); ++$i){$letter = $text{$i};$filename = "/goodies/letters/$letter.gif";$x = $width-20;$im = imagecreatetruecolor($width, 20);$image = imagecreatefromGIF($filename);imagecopyresampled($im, $image, $x, 0, 0, 0, $width, 20, 20, 20);$width = $width+20;}header('Content-type: image/gif');imageGIF($im);imageDestroy($im);?> But to no avail...All I get is a big black box (good thing is that it changes by 20 pixels for every letter you have)PS- Each source image is 20x20.View- clickyI tried removing $im = imagecreatetruecolor($width, 20); but that just returned http://www.habbground.com/txtst.php?text=ABCDE
  13. Okay, but say the user inputs "Blue"How would I make it so each letter of the variable (that blue is stored in) gets added to the image, and how would i make sure the image is the right size, no matter how many letter there are?
  14. But how do you merge multiple images with imagecopyresampled?All I can see on the reference page is manipulating one image, and copying it to a new file.
  15. Yes, the png file is in the right spot...Strange as it may sound, it's now working, I tried it before adding in the buffer stuff, and it worked :)Anyways, how would I go about making it so the user inputs two colors, and both colors in the image are changed?Finally (rather off-topic), my other question, is there a way to have a text generator where if the user inputs ABC, one image is generated using the images a.png, b.png, and c.png? (I know the answer is yes, I just don't know how)
×
×
  • Create New...