image on image banner

hey guys, i need a little help that i cant figure it out.

i used the function example “imagettftext($img, 15, 0, 35, 25, $weiss, $font, $servername);”

to write text on a image and works good but i needed to write an image on an image like this

on the right side there is a graph i have that graph cache link and i wanted to apply that to my auto refresh image

http://bomb3rman.com/bannerxd/bannerteste/
thanks

If you were able to create the image, what trouble are you having?

my problem is i cant put an image on top of that image.
i can write text on the image and when it updates is shows the text but i wanted to put one image there aswell
like this

you can see at the right side it shows 2 images i wanted to do the same but i dont know the code
text to image its imagettftext($img, 15, 0, 35, 25, but image to image i dont know

this is more or less the codee see there the imagettftext function?
i need one that allows me to add an image and change the position of it

[php]<?php
// Set the content-type
header(‘Content-Type: image/png’);

// Create the image
$im = imagecreatetruecolor(400, 30);

// Create some colors
$white = imagecolorallocate($im, 255, 255, 255);
$grey = imagecolorallocate($im, 128, 128, 128);
$black = imagecolorallocate($im, 0, 0, 0);
imagefilledrectangle($im, 0, 0, 399, 29, $white);

// The text to draw
$text = ‘Testing…’;
// Replace path by your own font path
$font = ‘arial.ttf’;

// Add some shadow to the text
imagettftext($im, 20, 0, 11, 21, $grey, $font, $text);

// Add the text
imagettftext($im, 20, 0, 10, 20, $black, $font, $text);

// Using imagepng() results in clearer text compared with imagejpeg()
imagepng($im);
imagedestroy($im);
?>[/php]

If you have the 2 separate images, you can do it with CSS.

I never attempted to combine two separate images before with code. I have done with you done with adding text to images as seen below and keep reading.

[php]<?
session_start();
$image = ImageCreateFromPNG(‘http://www.example.com/images/tags/ziggyfrontb_m.png’);
imagealphablending($image, true);
imagesavealpha($image, true);
//ImageString($image, 5, 33, 30, ‘LUKE’, $text_color);
//$grey = imagecolorallocate($image, 128, 128, 128);
//$black = imagecolorallocate($image, 0, 0, 0);
$grey = imagecolorallocate($image,hexdec(substr($_SESSION[‘bc’],0,2)), hexdec(substr($_SESSION[‘bc’],2,2)), hexdec(substr($_SESSION[‘bc’],4,2)));
$black = imagecolorallocate($image,hexdec(substr($_SESSION[‘fc’],0,2)), hexdec(substr($_SESSION[‘fc’],2,2)), hexdec(substr($_SESSION[‘fc’],4,2)));
$font = $_SESSION[‘fontselected’];

$pettagtext = $_SESSION[‘pettagtext’];
// Add some shadow to the text
imagettftext($image, 20, 0, 30, 55, $grey, $font, $pettagtext);

// Add the text
imagettftext($image, 20, 0, 28, 53, $black, $font, $pettagtext);

header(‘Content-Type: image/png’);
ImagePNG($image);
imagedestroy($image);

?>
[/php]

So here is some code to merge two images, which is similar to above and what you have been doing and uses the imagecopymerge function.

[php]<?php
$dest = imagecreatefrompng(‘vinyl.png’);
$src = imagecreatefromjpeg(‘cover2.jpg’);

imagealphablending($dest, false);
imagesavealpha($dest, true);

imagecopymerge($dest, $src, 10, 9, 0, 0, 181, 180, 100); //have to play with these numbers for it to work for you, etc.

header(‘Content-Type: image/png’);
imagepng($dest);

imagedestroy($dest);
imagedestroy($src);
?>[/php]

thats the function i needed the imagecopymerge

thank you a lot :stuck_out_tongue:
sent you a tip for your help

Thanks :slight_smile:

Sponsor our Newsletter | Privacy Policy | Terms of Service