0
I have a code that generates an electronic signature but when the user clicks right on the image generated to "Save image as" the name of the image comes as default name_pagina.php.png.
How do I get the .php
of the file name to be saved?
Because lay users are not knowing how to rename the file to remove the extension .php
<?php
header("Content-type: image/png");
$image = imagecreatefrompng("assinatura.png");
$imageCel = imagecreatefrompng("cel.png");
$imageWhats = imagecreatefrompng("whats.png");
$imgPira = imagecreatefrompng("piracicaba.png");
$imgBotucatu = imagecreatefrompng("botucatu.png");
$imgLencois = imagecreatefrompng("lencois.png");
$imgJau = imagecreatefrompng("jau.png");
if (!empty ($_POST["name"])) {
$fotinha = $_POST["name"];
$imgFotinha = imagecreatefrompng("upload/".$fotinha.".png");
}
$tileColor = imagecolorallocate($image, 0, 63, 114);
$gray = imagecolorallocate($image, 100, 100, 100);
$nome = $_POST["nome"];
$funcao = $_POST["funcao"];
$telefone = $_POST["telefone"];
$email = $_POST["email"];
$cel = $_POST["cel"];
if (!empty($_POST["cel"])) {
imagecopy($image, $imageCel, 445, 17, 0, 0, 12, 16);
imagettftext($image, 10, 0, 460, 30, $tileColor, "C:\\xampp\\htdocs\\assinatura\\fonts\\Helvetica\\Helvetica-Normal.ttf", $cel);
if (isset($_POST["whats"])) {
imagecopy($image, $imageWhats, 560, 17, 0, 0, 15, 16);
}
}
if (!empty ($_POST["name"])) {
imagecopy($image, $imgFotinha, 10, 16, 0, 0, 100, 100);
}
imagettftext($image, 12, 0, 110, 33, $tileColor, "C:\\xampp\\htdocs\\assinatura\\fonts\\Helvetica\\Helvetica Bold.ttf", $nome);
imagettftext($image, 10, 0, 120, 50, $tileColor, "C:\\xampp\\htdocs\\assinatura\\fonts\\Helvetica\\Helvetica-Normal.ttf", $funcao);
imagettftext($image, 10, 0, 332, 30, $tileColor, "C:\\xampp\\htdocs\\assinatura\\fonts\\Helvetica\\Helvetica-Normal.ttf", $telefone);
imagettftext($image, 11, 0, 334, 56, $tileColor, "C:\\xampp\\htdocs\\assinatura\\fonts\\Helvetica\\Helvetica-Normal.ttf", $email);
$filial = $_POST["filial"];
if ($filial == "piracicaba") {
imagecopy($image, $imgPira, 310, 75, 0, 0, 324, 11);
}
if ($filial == "botucatu") {
imagecopy($image, $imgBotucatu, 310, 75, 0, 0, 324, 11);
}
if ($filial == "lencois") {
imagecopy($image, $imgLencois, 310, 75, 0, 0, 324, 11);
}
if ($filial == "jau") {
imagecopy($image, $imgJau, 310, 75, 0, 0, 324, 11);
}
imagepng($image);
imagedestroy($image);
?>
This happens because you are generating an image from a php page, you can set a Roa to a separate image or make a button download image
– Erlon Charles
how can I make this route?
– Fernando Fefu
This is a simple example of how to do https://www.taniarascia.com/the-simplest-php-router . It has more complete and complex forms, but initially this must solve
– Erlon Charles