ILYAS415 Posted December 3, 2007 Share Posted December 3, 2007 Hiya im workin on my own php image (first one ever) and with a help of a few tutorials i hav come up with... www.ragingmortals.com/tester.php What i need to do is put another image like... www.ragingmortals.com/images/characters/any image in this directory onto my php made image. Just wondering how i could do that. If you have enough time could you please add it onto this script and explain for me? Thanks... p.s. im currently working on the page so plz refresh if their are errors. <? //CREATED BY WASIM ILYAS!<-- THATS ME! ILYAS THE GREAT header ("Content-type: image/gif"); $im= imagecreatefromgif("images/user.gif"); //Image i want to use $color = imagecolorallocate($im, 255,255,255); //Text color set to white $txt = (imagesx($im) - 260); //Text will be on the positions (-260 the image width). $txt2 = (imagesx($im) - 390); imagestring($im, 3, $txt, 15, "Hi guys im still making this image", $color); imagestring($im, 3, $txt, 30, "so Please...leave now", $color); imagestring($im, 3, $txt2, 15, "Another img to", $color); imagestring($im, 3, $txt2, 30, "be put here", $color); imagegif($im); imagedestroy($im); ?> Quote Link to comment Share on other sites More sharing options...
MadTechie Posted December 3, 2007 Share Posted December 3, 2007 So whats the question ?.. sounds like you just want someone to add code and explain it step by step ! also how urgent is this ? Quote Link to comment Share on other sites More sharing options...
ILYAS415 Posted December 3, 2007 Author Share Posted December 3, 2007 lol well.... okay the question is... how do i put an image onto the gd img i povided? i hav no idea how to do and google gives me weird results. Quote Link to comment Share on other sites More sharing options...
MadTechie Posted December 3, 2007 Share Posted December 3, 2007 erm.. maybe this <?php $im= imagecreatefromgif("images/".$_GET['img']); //Image i want to use ?> Quote Link to comment Share on other sites More sharing options...
ILYAS415 Posted December 3, 2007 Author Share Posted December 3, 2007 won't that replace the image i already have on their? Quote Link to comment Share on other sites More sharing options...
MadTechie Posted December 3, 2007 Share Posted December 3, 2007 i don't see how.. your not saving the image! Quote Link to comment Share on other sites More sharing options...
phorcon3 Posted December 3, 2007 Share Posted December 3, 2007 <?php $bg = './images/example.png';//url->img ex: (www/images/example.png) $img = imagecreatefrompng($bg);//creates img from file header('Content-type: image/png'); imagepng($img);//output ?> maybe this helps: http://at2.php.net/manual/en/function.imagecreatefrompng.php Quote Link to comment Share on other sites More sharing options...
ILYAS415 Posted December 3, 2007 Author Share Posted December 3, 2007 ummm i dont think that'll help... what im trying to do is create a picture ontop of the other picture (so both pictures are still showing) and then use then position the second picture somewhere on the first picture. ive already made the first picture (which is on the code i specified) now i need to make a second picture_. Quote Link to comment Share on other sites More sharing options...
MadTechie Posted December 3, 2007 Share Posted December 3, 2007 Create a new image palette (imagecreate) then merge the image into it imagecopymerge Quote Link to comment Share on other sites More sharing options...
ILYAS415 Posted December 3, 2007 Author Share Posted December 3, 2007 Okay come up with an error... www.ragingmortals.com/tester.php New code: <? //CREATED BY WASIM ILYAS!<-- THATS ME! ILYAS THE GREAT require_once "includes/db_connect.php"; session_start(); $query= mysql_query("SELECT * FROM users WHERE username='$username'"); header ("Content-type: image/gif"); $im= imagecreatefromgif("images/user.gif"); //Image i want to use $color = imagecolorallocate($im, 255,255,255); //Text color set to white $txt = (imagesx($im) - 260); //Text will be on the positions (-260 the image width). $txt2 = (imagesx($im) - 390); imagestring($im, 3, $txt, 15, "Hi guys im still making this image", $color); imagestring($im, 3, $txt, 30, "so Please...leave now", $color); imagestring($im, 3, $txt2, 15, "Another img to", $color); imagestring($im, 3, $txt2, 30, "be put here", $color); imagestring($im, 3, $txt, 45, "$username", $color); $secondim= imagecreatefromgif("images/characters/rmchar5.gif"); imagecopymerge($im, $secondim, 0, 0, 15, 15);; imagegif($im); imagedestroy($im); ?> Quote Link to comment Share on other sites More sharing options...
MadTechie Posted December 3, 2007 Share Posted December 3, 2007 okay as your not telling us the error i'll guess.. its on this line imagecopymerge($im, $secondim, 0, 0, 15, 15);; //<-Right ? Now i can see 2 problems with that.. 1. you have 2 ;;'s 2. read the manual for the imagecopymerge sorry but if you won't make an effort then why should i! Quote Link to comment Share on other sites More sharing options...
ILYAS415 Posted December 3, 2007 Author Share Posted December 3, 2007 Okay i think i kinda got it now. Took a while tho Hav a kl now and pls advise on any changes... i changed the imagecopymerge function to imagecopymerge($im, $secondim, 0, 0, 15, 15, 71, 146, 100); Quote Link to comment Share on other sites More sharing options...
ILYAS415 Posted December 3, 2007 Author Share Posted December 3, 2007 Hmm any their? Okay I have another problem now... www.ragingmortals.com/tester.php How do i get rid of the black part? Quote Link to comment Share on other sites More sharing options...
helraizer Posted December 3, 2007 Share Posted December 3, 2007 Hmm any their? Okay I have another problem now... www.ragingmortals.com/tester.php How do i get rid of the black part? This should have the desired effect (you need to add in the database parts and file locations yourself) <?php header ("Content-type: image/gif"); $im= imagecreatefromgif("user.gif"); //Image i want to use $color = imagecolorallocate($im, 255,255,255); //Text color set to white $txt = (imagesx($im) - 260); //Text will be on the positions (-260 the image width). $txt2 = (imagesx($im) - 390); imagestring($im, 3, $txt, 15, "Hi guys im still making this image", $color); imagestring($im, 3, $txt, 30, "so Please...leave Angry now", $color); imagestring($im, 3, $txt, 45, $username, $color); $secondim= imagecreatefromgif("rmchar5.gif"); imagecopymerge($im, $secondim, 10, 15, 0, 0, 71, 146, 100); imagegif($im); imagedestroy($im); ?> the black part was to do with this part: imagecopymerge($im, $secondim, 0, 0, 15, 15, 71, 146, 100); The code I have there gives this output: Sam Quote Link to comment Share on other sites More sharing options...
ILYAS415 Posted December 3, 2007 Author Share Posted December 3, 2007 Thanks Alot Helraizer. It worked! The only thing i can say now is...... TOPIC SOLVED Quote Link to comment Share on other sites More sharing options...
helraizer Posted December 3, 2007 Share Posted December 3, 2007 Thanks Alot Helraizer. It worked! The only thing i can say now is...... TOPIC SOLVED Glad I could help. Need anything else, just holler. Sam Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.