Ver Mensaje Individual
  #2 (permalink)  
Antiguo 08/04/2016, 23:22
thezzin
 
Fecha de Ingreso: septiembre-2008
Mensajes: 350
Antigüedad: 18 años
Puntos: 31
Respuesta: unir imágenes con libería GD

intenta con este code:

Código PHP:
<?php 
$theimg 
= 'imagenproducto.jpg';
list(
$width, $height) = getimagesize($theimg);
$percent = 0.7; // porcentage del resize
$new_width = $width * $percent;
$new_height = $height * $percent;
//Imagen del fondo
$image_fondo = imagecreatetruecolor(360, 340);//Tamaño||Si quieres que el fondo sea el mismo de la image use $new_width, $new_height en ves de los numeros
$white = imagecolorallocate($image_fondo, 255, 255, 255);//Color del fondo
imagefill($image_fondo, 0, 0, $white);
//FIN imagen fondo
//imagel texto
$ForestGreen = imagecolorallocate($image_fondo, 34, 139, 34);//Colot Texto
$text = 'php7-GD img Fondo 360x x 340px';//texti
imagestring($image_fondo, 5, 50, 160, $text, $ForestGreen);//Posicion del texto
//                        |   |    |
//                        |   |    Arriba y Abajo
//                        |   Izquierda y a Derecha
//                        Tamaño del texto de 0-5
//FIN imagel texto
//Imagen copy 1 y 2
$image = imagecreatefromjpeg($theimg);//imagen origen
imagecopyresampled($image_fondo, $image, 6, 2, 0, 0, $new_width, $new_height, $width, $height);//Imagen copy 1
imagecopyresampled($image_fondo, $image, 6, 244, 0, 0, $new_width, $new_height, $width, $height);//Imagen copy 2
//                                       |    |       ^Nuevo ancho ^ y Alto * ^Original Ancho ^alto
//                                       |    mueve la imagen  ariba y abajo
//                                       mueve la imagen  Derecha y Izquierda
//FIN //Imagen copy 1 y 2
header("Content-type: image/jpeg");
imagejpeg($image_fondo, null, 100);
//imagejpeg($image_fondo,"imagenes/real/thezzin.jpg");//para que la imagen sea copiada a un folder desactivar esta line y apagar el header() arriba y esta: imagejpeg($image_fondo, null, 100);

?>
eso te genera una imagen como esta:


y esta fue la imagen que use:
__________________
╬-----╬
║☺₧☻║
╬-----╬

Última edición por thezzin; 08/04/2016 a las 23:48