1

I am getting error with this code

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

$nomphoto = "antigua.jpg";

// On charge d'abord les images
$source = imagecreatefrompng('logo.php');


$destination = imagecreatefromjpeg($nomphoto); 


$largeur_source = imagesx($source);
$hauteur_source = imagesy($source);
$largeur_destination = imagesx($destination);
$hauteur_destination = imagesy($destination);



$destination_x = 0;
$destination_y =  ($hauteur_destination / 1.5) - ($hauteur_source / 2);


imagecopymerge($destination, $source, $destination_x, $destination_y, 0, 0, $largeur_source, $hauteur_source, 60);


imagejpeg($destination);

I cannot load the pictures from logo.php

Code of logo.php

$imgPng = imagecreatefrompng("logo24.png");
imagealphablending($imgPng, true);
imageSaveAlpha($imgPng, true);

header("Content-type: image/png");
imagePng($imgPng); 

I want to put a copyright with my png-24 image. logo.php is working fine, I can get the picture but when I use it with imagecreatefrompng, it is not working.

I tried with imagecreatefrompng(file_get_contents('logo.php')); but it is also not working. What I want is put my png-24 copyright image on my jpg (to keep transparency) You guyz do you have any solutions?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Dorian_gd
  • 181
  • 1
  • 13

1 Answers1

0

Solution by OP.

Instead of using imagecopymerge(), have to use imagecopy()

imagecopy($destination, $source, $destination_x, $destination_y, 0, 0, $largeur_source, $hauteur_source);

And then don't need to logo.php code. Just load the png-24 image.

Cœur
  • 37,241
  • 25
  • 195
  • 267