Jump to content

GD Library Help ... placing an Image ontop of an image?


Jnerocorp

Recommended Posts

Hello,

 

I am using to external images to place one on top of the other but its not working correctly

 

This image is to be on top: http://www.everyday-taichi.com/image-files/youtube-play.jpg

This Image is to be on the bottom: http://img.youtube.com/vi/7Lfyk9yQPYk/default.jpg

 

This is what I have so far but its like cutting away at the images: http://JneroCorp.com/test.php

 

Here is the code I have:

<?php
$src = imagecreatefromjpeg( 'http://img.youtube.com/vi/7Lfyk9yQPYk/default.jpg' );
$dst = imagecreatefromjpeg( 'http://www.everyday-taichi.com/image-files/youtube-play.jpg' );

imagecopymerge( $dst, $src, 1, 1, 0, 0, 200, 200, 80 );
header( 'Content-type: image/jpeg' );
imagejpeg( $dst );
imagedestroy( $src );
imagedestroy( $dst );
?>

 

Its because your destination image is the smaller of the two.

 

This looks good to me:

 

   $dst = imagecreatefromjpeg( 'http://img.youtube.com/vi/7Lfyk9yQPYk/default.jpg' );
   $src = imagecreatefromjpeg( 'http://www.everyday-taichi.com/image-files/youtube-play.jpg' );
   
   imagecopymerge( $dst, $src, 30, 20, 0, 0, 61, 44, 80 );
   header( 'Content-type: image/jpeg' );
   imagejpeg( $dst );
   imagedestroy( $src );
   imagedestroy( $dst );

Archived

This topic is now archived and is closed to further replies.

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