3
I wonder if there is any way to define the height, and the default width in php, I saw some forms, but I used an external class, I wonder if there is any way to use the GD library...
$dest = imagecreatefromjpeg('imgs/bg.jpg');
$tamanho = imagesx($dest);
$width = 594;
$height = 387;
$src = imagecreatefrompng('imgs/textura.png');
imagealphablending($dest, false);
imagesavealpha($dest, true);
imagecopymerge($dest, $src, -30, -50, 0, 0, 700, 500, 50);
header('Content-Type: image/png');
imagepng($dest);
imagedestroy($dest);
imagedestroy($src);
Here I posted an answer that shows how to size an image using the GD http://answall.com/a/9757/70 library - By comments you can understand what each part of the code does.
– Bacco
Still a little complicated, I already have a code ready, I’ll edit the question to improve, this my code it puts an image on top of another, but when the image is less than 500px the one on top does not centralize, the solution would be to resize or use if for different sizes...
– Bruno
to center just do the bill:
margem esquerda = ( largura da maior - largura da menor ) / 2
, and the same thing for the upper margin.– Bacco
I didn’t understand what you said, the margin I set on this line >imagecopymerge($dest, $src, -30, -50, 0, 0, 700, 500, 50); Ali on "-30"
– Bruno
What you need to do is replace the -30 and the -50 with the formula I posted. To see how to get these variables, just give a read on that answer I made the link.
– Bacco
When you say "largest size" and "Smallest size" is the largest/smallest image tamamho?
– Bruno