PHP - de ttf a imgen conrotacion

 
Vista:

de ttf a imgen conrotacion

Publicado por civitasv (1 intervención) el 28/06/2010 14:57:45
hola gente, necestio q alguien me ayude xfa!...tengo una aplicacion php que convierte fuento ttf en imagen, ahora necesito aplicar un giro a esa imagen, es decir girar la imagen segun los grados seleccionado desde los botoes de opcion ya sea 90, 40 o 25 grados (0 grados para volver).
el codigo es el sig:

en ajax.js tengo la siguiente funcion
function ttfToImage(){
var fuente,contenedor,texto,grados;
contenedor = document.getElementById('ttfToImage');
texto = document.fonts.texto.value;
fuente = document.fonts.fonts.options[document.fonts.fonts.selectedIndex].value;
grados = document.fonts.grados.value;
ajax=nuevoAjax();
ajax.open('GET', 'fonts.php?option=image&fuente='+fuente+'&texto='+ texto+'&grados='+grados,true);
ajax.onreadystatechange=function() {
if (ajax.readyState==4) {
contenedor.innerHTML = ajax.responseText
}
}
ajax.send(null);
}

en el formulario fonts.php

switch($_GET["option"]){
case "image":
print "<table width=50% border=0><tr><td>".
"<img src='fonts.php?option=ttf&fuente=$_GET[fuente]&texto=$_GET[texto]&grados=$_GET[grados]'>".
"</td></tr></table>";
break;
case "ttf":
openFont($_GET["fuente"], $_GET["texto"], $_GET["grados"]);
break;

function openFont($fuente, $texto="ingrese su texto", $grados){
header("Content-type: image/gif");
$imagen = imagecreate(500,100);
$bg = imagecolorallocate($imagen,255,255,255);
$gris = imagecolorallocate($imagen,100,100,100);
$fuente = "./".$fuente;
imagettftext($imagen,40,$grados,0,53,$gris,$fuente ,$texto);
$rotar = imagerotate($imagen, $grados, 0);
imagejpeg($rotar);
imagegif($imagen);
imagedestroy($imagen);
}
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder