Tengo un pequeño problema, y es que estoy acabando de configurar que un usuario pueda introducir texto en una imagen con php, y que esta se muestre en una pestaña aparte pulsando a un botón. Esto ya lo he conseguido y funciona correctamente. Sin embargo, estoy buscando, a través de un <select>, que se pueda elegir el tamaño.
Este es el código que tengo:
Código :
<form method="get" action="aa.php"> <input type="text" name="aa" id="aa"> <select name="saa"> <option value='230'>230</option> <option value='50'>50</option> </select> <button>Generar</button> </form>
que va enlazado a esta página de php
Código :
<?php
// Set the content-type
$imagen = imagecreatefrompng('imagen.png');
// Create the image
$black = imagecolorallocate($imagen, 0, 0, 0);
// The text to draw
if(isset($_GET['textaa'])){
$texto=$_GET['textaa'];
}else{
$texto="";
}
$font = 'fuente.otf';
// Add the text
imagettftext($imagen, 48, 0, 48, 70, $black, $font, $texto);
//The width to draw
if( isset( $_POST['saa'] ) ){
if( $_POST['saa'] == "230" ) {
$ancho=$_POST (230);
} elseif( $_POST['saa'] == "50" ) {
$ancho=$_POST (50);
} else {
echo "nothing chosen";
}
}
$width = 200;
$newwidth = $width;
$newheight = $height;
imagecopyresized($nuevaimagen, $imagen, 0, 0, 0, 0, $newwidth, $newheight, $ancho, $alto);
header("Content-type: image/png");
imagepng($nuevaimagen);
?>No se por qué no funciona.
Un saludo y gracias
