Admin Admin
Mensajes : 36 Fecha de inscripción : 17/09/2011
| Tema: Publicar noticias con su imagen en miniatura correspondiente Miér Oct 12, 2011 11:22 am | |
| Al crear un sistema de publicación de noticias puede resultar atractivo que al lado de la noticia tengamos una previsualización en miniatura (thumbnail) de la URL a la que enlaza la noticia. Es un recurso bastante utilizado en agregadores de noticias y ofrece un toque de color visible. - Código:
-
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>rincondelcodigo.com</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <!-- Caracteres_formulario --> <script LANGUAGE="JavaScript"> function textCounter(field, countfield, maxlimit) { if (field.value.length > maxlimit) field.value = field.value.substring(0, maxlimit); else countfield.value = maxlimit - field.value.length; } </script> </head>
<body> <form name="form1" method="post" action=""> <strong>Titular:</strong><br> <input type="titular" name="titular"> <br><strong>Desarrollo:</strong><br> <textarea name="texto" wrap="physical" cols="50" rows="5" onKeyDown="textCounter(this.form.texto,this.form.remLen,650);" onKeyUp="textCounter(this.form.texto,this.form.remLen,650);"></textarea> <br><input readonly type="text" name="remLen" size="3" maxlength="3" class="Estilo2" value="650"> <br><strong>URL de la noticia:</strong><br> <input name="url" type="text" value="http://"> <br> <input type="submit" name="Submit" value="Enviar"> </form> <?php if (($_POST['titular']!="") && ($_POST['texto']!="") && ($_POST['url']!="")) { echo "<blockquote><h3><a href='".$_POST['url']."'>".$_POST['titular']."</a><br>"; echo $_POST['texto']."</h3></blockquote>"; echo "<a href='".$_POST['url']."' target='_blank'><img src='http://open.thumbshots.org/image.pxf?url= ".$_POST['url']."' alt='Otros' width='100' height='80' border='0' align='absmiddle' /></a>"; } ?> </body> </html> | |
|