que tal a todos les quiero compartir un script que hize en php, lo que hace es a partir de una imagen que se le envia crea una imagen hecha con celdas html, cada pixel lo convierte a una celda con un style que contine como color de fondo el del pixel, en el browser se ve como si fuese una imagen normal pero esta hecha con html.
espero les guste, :vientos: el ejemplo esta en :
http://jv.orgfree.com/proyectos/php/imagenhtml.php
el codigo es el siguiente:
<html>
<head>
<style>
.img td{width:1px; height:1px;}
</style>
</head>
<body>
<form action="" method="POST" enctype="multipart/form-data">
<input type="file" name="img"/>
<input type="submit" value="enviar"/>
</form>
<?php
// Obtenemos la imagen
if(isset($_FILES['img']['tmp_name']))
{
$im = imagecreatefromjpeg($_FILES['img']['tmp_name']);
echo "<table cellspacing='0' cellpadding='0' class='img'>";
// Recorremos cada pixel de X y Y
for( $y = 0; $y < imagesy( $im ); $y++ ){
echo "<tr>
";
for( $x = 0; $x < imagesx( $im ); $x++ ){
// Obtenemos el valor del color de cada pixel
$rgb = imagecolorat( $im, $x, $y );
// Convertimos a Hexadecimal
$hex = sprintf("%06X", $rgb );
// Imprimimos la letra con su color
echo '<td style="background-color:'.$hex.';"></td>';
}
echo "</tr>
";
}
echo "</table>";
imagedestroy( $im );
}
?>
</body>
</html>
espero les guste, :vientos: el ejemplo esta en :
http://jv.orgfree.com/proyectos/php/imagenhtml.php
el codigo es el siguiente:
<html>
<head>
<style>
.img td{width:1px; height:1px;}
</style>
</head>
<body>
<form action="" method="POST" enctype="multipart/form-data">
<input type="file" name="img"/>
<input type="submit" value="enviar"/>
</form>
<?php
// Obtenemos la imagen
if(isset($_FILES['img']['tmp_name']))
{
$im = imagecreatefromjpeg($_FILES['img']['tmp_name']);
echo "<table cellspacing='0' cellpadding='0' class='img'>";
// Recorremos cada pixel de X y Y
for( $y = 0; $y < imagesy( $im ); $y++ ){
echo "<tr>
";
for( $x = 0; $x < imagesx( $im ); $x++ ){
// Obtenemos el valor del color de cada pixel
$rgb = imagecolorat( $im, $x, $y );
// Convertimos a Hexadecimal
$hex = sprintf("%06X", $rgb );
// Imprimimos la letra con su color
echo '<td style="background-color:'.$hex.';"></td>';
}
echo "</tr>
";
}
echo "</table>";
imagedestroy( $im );
}
?>
</body>
</html>