FRIHOST FORUMS SEARCH FAQ TOS BLOGS COMPETITIONS
You are invited to Log in or Register a free Frihost Account!


Layering Images





jeremyyak
Ok, right now this is my script:
Code:
<?php
   $diagramWidth = 577;
   $diagramHeight = 34*$_POST['ucount'];

   $image = imageCreateTrueColor ($diagramWidth, $diagramHeight);
   $imagebg = imageCreateFromPNG ('tile.png');

   imageSetTile ($image, $imagebg);
   imageFilledRectangle ($image, 0, 0, $diagramWidth, $diagramHeight, IMG_COLOR_TILED);

   $textcolor1 = imageColorAllocate ($image, 80, 80, 80);
   $textcolor2 = imageColorAllocate ($image, 255, 255, 255);

   imageString ($image, 3, 10, 20, 'Test...', $textcolor1);
   imageString ($image, 3,  9, 19, 'Test...', $textcolor2);

   Header("Content-type: image/png");
   imagePNG ($image);

   imagedestroy ($image);
   imagedestroy ($imagebg);
?>

How do I make it so I can place another image, lets say 'header.png', on top of the current tileing one?
hexkid
jeremyyak wrote:
How do I make it so I can place another image, lets say 'header.png', on top of the current tileing one?


With a imagecopy*() function
Code:
<?php
// ...
imageString ($image, 3,  9, 19, 'Test...', $textcolor2);

$header = imagecreatefrompng('header.png');
imagecopymerge($image, $header, 0, 0, 0, 0, 577, 17, 50);
imagedestroy($header);

header('Content-Type: image/png');
//...
?>


imagecopy()
imagecopymerge()
imagecoptmergegray()
imagecopyresampled()
imagecopyresized()
jeremyyak
Thanks alot, thats exactly what I was looking for Very Happy
~Jeremy~
Related topics
W3C buttons without images
Some nature's images
Good photoshop images
wont load images
[tutor] How to protect images without htaccess using PHP
all images appear corrupt!
What do you use to make your page layout?
South Brazil Beach... very nice! | 640x480 images
Dynamic PHP Images
Can't change permissions? Could not change perms on images
Please show me how to create some 3D images
Please show me how to create some 3D images
Please show me how to create some 3D images
A better alternative to The Gimp?
Reply to topic    Frihost Forum Index -> Scripting -> Php and MySQL

FRIHOST HOME | FAQ | TOS | ABOUT US | CONTACT US | SITE MAP
© 2005-2011 Frihost, forums powered by phpBB.