Portegag2’s Weblog

Just another WordPress.com weblog

Posts Tagged ‘fotos’

Lotes con fotos

Posted by portegag2 on December 11, 2008

Para trabajar con lotes,  ARCHIVO/AUTOMATIZAR/LOTE…

lo primero es crear una acción… y para ello: http://www.dzoom.org.es/noticia-1724.html

Posted in bikain | Tagged: , , , , | Leave a Comment »

Mostrar imagen de noticia

Posted by portegag2 on July 8, 2008

Para la imagen a mostrar en las noticias del inicio lo haremos así:

Incluir en la tabla fotosnoticia un campo, llamado, enportada (SI/NO).

Hacer un formulario con las imágenes y cada una tendrá un radiobutton, name=enportada value=nombrefoto.

y un campo oculto con noticia=…

en la página fotosnoticia: si $_GET[axnf]=’updf’

update fotosnoticia set enportada=0 where noticia=$_post[noticia]

update fotosnoticia set enportada=1 where noticia=$_post[noticia] and foto=$_post[enportada]

Posted in noticias | Tagged: , , , | Leave a Comment »

Redimensionar imagenes

Posted by portegag2 on July 7, 2008

El siguiente código sólo funciona con jpeg o con gif, pero no con ambos. En realidad dónde pone jpeg se pone gif o png y ya valdría.
La llamada es:

<img src="redimensionar.php?ruta=fotos/$row_foto_subfam[foto]&ancho=128&alto=98" alt="$row_foto_subfam[nombreproducto]" />

El archivo redimensionar.php tiene este código:


<?php
/*Este Archivo Recibe Los Parametros $ruta, Que Es La Ruta Interna De La Imagen En El Servidor,
Y Los Parametros $ancho y $alto Que Se Refiere Al Alto Y Ancho De La Previsualizacion.*/
$F_ancho = $_GET["ancho"];
$F_alto = $_GET["alto"];
$fuente = @ImagecreatefromJpeg($_GET["ruta"]);
$imagen = Imagecreatetruecolor($F_ancho, $F_alto); // crea el recurso gd para la salida
// desactivo el procesamiento automatico de alpha
Imagealphablending($imagen, false);
// hago que el alpha original se grabe en el archivo destino
Imagesavealpha($imagen, true);
Imagecopyresampled($imagen, $fuente, 0, 0, 0, 0, $F_ancho, $F_alto, ImageSX ($fuente),imagesy($fuente)); // redimensiona
header("Content-type: image/jpeg");
imagejpeg($imagen);
?>

En una función no he conseguido hacerlo.

Intuyo además que se podría hacer con porcentajes, haciendo cálculos con los porcentajes y las propiedades de los archivos, pero en fin.

Hay que tener en cuenta que hace falta llamar a la función get_extension, que está en el fichero utils.php.

Esto o poner el código de get_extension directamente en este archivo; redimensionar.php

Finalmente el código queda:


<?php

include ("admin/utils.php");
/*Este Archivo Recibe Los Parametros $ruta, Que Es La Ruta Interna De La Imagen En El Servidor,
Y Los Parametros $ancho y $alto Que Se Refiere Al Alto Y Ancho De La Previsualizacion.*/
$F_ancho = $_GET["ancho"];
$F_alto = $_GET["alto"];
//$fuente = @ImagecreatefromJpeg($_GET["ruta"]);
$imagen = Imagecreatetruecolor($F_ancho, $F_alto); // crea el recurso gd para la salida
// desactivo el procesamiento automatico de alpha
Imagealphablending($imagen, false);
// hago que el alpha original se grabe en el archivo destino
Imagesavealpha($imagen, true);

$ext= strtolower(get_extension($_GET["ruta"]));

switch ($ext){
case "jpg":
$fuente = @ImagecreatefromJpeg($_GET["ruta"]);
Imagecopyresampled($imagen, $fuente, 0, 0, 0, 0, $ancho, $alto, ImageSX ($fuente),imagesy($fuente));
header("Content-type: image/jpeg");
imagejpeg($imagen);
break;
case "gif":
$fuente = @ImagecreatefromGif($_GET["ruta"]);
Imagecopyresampled($imagen, $fuente, 0, 0, 0, 0, $ancho, $alto, ImageSX ($fuente),imagesy($fuente));
header("Content-type: image/gif");
imagegif($imagen);
break;
}
?>

Posted in club5s | Tagged: , , | Leave a Comment »

Ultimos detalles

Posted by portegag2 on July 7, 2008

Que los nombres de los ficheros tengan caracteres estandar.

Solución:

he copiado una funcion y además les he quitado lso espacios:

Funcion:

function elimina_acentos($cadena){
$tofind = "ÀÁÂÃÄÅàáâãäåÒÓÔÕÖØòóôõöøÈÉÊËèéêëÇçÌÍÎÏìíîïÙÚÛÜùúûüÿÑñ";
$replac = "AAAAAAaaaaaaOOOOOOooooooEEEEeeeeCcIIIIiiiiUUUUuuuuyNn";
return(strtr($cadena,$tofind,$replac));
}

Recogida del nombre:

$imagen=str_replace(" ", "", elimina_acentos($_FILES["foto$k"]['name']));;

Posted in noticias | Tagged: , , , | Leave a Comment »

A Hacer en fotos

Posted by portegag2 on July 4, 2008

Limpiar el código de mensajes

Intentar quitar el reborde de las fotos. Sale al ponerlas como enlace. En los CSS he puesto border=0 y no funcionaba, pero al ponerlo en el código de la img, sí ha funcionado ???

Posted in noticias | Tagged: , , , | Leave a Comment »

Fotos de noticias

Posted by portegag2 on July 4, 2008

Cada noticia puede tener una o varias fotos asociadas. Esta relación se mantendrá en la tabla: fotosnoticia (noticia, archivo).

1: Insertar un icono (fotos.gif) en la tabla de visualización de noticias.

2: Pagina prpl del mantenimiento de las fotos de una noticia:

3. Ellos han manejado un código para subir estas fotos en:

  • EL NEGOCIO: C:\SYS\TMC\PROYECTOS\EUSKALIT\SEMANA EUROPEA\aktuak.php
  • EL FORMULARIO: C:\SYS\TMC\PROYECTOS\EUSKALIT\SEMANA EUROPEA\nuevoacto.php

Posted in noticias | Tagged: , , , | Leave a Comment »