combine 2 images into 1

images php coding issues or problems here.

Moderators: macek, egami, gesf

User avatar
ruturajv
php-forum Super User
php-forum Super User
Posts: 1280
Joined: Sat Mar 22, 2003 9:42 am
Location: Mumbai, India
Contact:

jp graph

Postby ruturajv » Sat Feb 28, 2004 7:25 am

hi,
I can't really help with the code...
but do download the jpgraph.
it really has some cool classess for all that you want, plus the graphs...
AND YES ITS GOT ALPHA BLENDING

sergio_mi
New php-forum User
New php-forum User
Posts: 23
Joined: Thu Apr 22, 2004 7:00 am

ImageCopy();

Postby sergio_mi » Mon May 17, 2004 5:22 am

i'm a newbie, but i've just done that.
<?php // imgCreator.php

header("Content-type: image/jpeg");

$im1 = imagecreatefromjpeg("images/background.jpg");
$im2 = imagecreatefrompng("images/logo.png");
ImageCopy($im1,$im2,0,0,0,0,608,300);look for imageCopy(); in php.net
Imagejpeg($im1,'',90);
imagedestroy($im1);
imagedestroy($im2);
?>

html page
<img src="imgCreator.php" border=0>

waiting for replay

George the Flea
New php-forum User
New php-forum User
Posts: 5
Joined: Mon Jul 26, 2004 10:42 pm
Location: Washington
Contact:

Postby George the Flea » Mon Aug 02, 2004 8:59 pm

You need to enable alpha blending on the base image (this isn't necessary on the one that has transparency for some reason). Modified code would be this:

Code: Select all

<?php // imgCreator.php
     
header("Content-type: image/jpeg");
                                                 
   $im1 = imagecreatefromjpeg("images/background.jpg");
   imagealphablending($im1, true); // this has to be before imagecopy();
   $im2  = imagecreatefrompng("images/logo.png");
   imagecopy($im1,$im2,0,0,0,0,608,300); 
   imagejpeg($im1,'',90);
   imagedestroy($im1);
   imagedestroy($im2);
   ?>


Return to “PHP coding => Images”

Who is online

Users browsing this forum: No registered users and 1 guest

cron