Jump to content

[SOLVED] Urgent GD Image question needs answeriing.


ILYAS415

Recommended Posts

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);

?>

Link to comment
Share on other sites

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_.

Link to comment
Share on other sites

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);

?>

Link to comment
Share on other sites

Hmm any their? :P

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:

 

char.gif

 

Sam

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.