Desarrollo el sitio www.autocasionextremadura.com
En mi WEB tengo una única foto por coche y está en un Blob :
Se me ocurre:
1- Cuando doy de alta una ficha, que el script dimensione dos fotos: una grande y una pequeña desde la misma fuente ... y arreglado. Pero ahora no puedo reconstruir todo
2- Lo que estoy intentando ahora.
Por un lado: cuando se consulta una referencia y no hay foto:
"if ($im == false) {
header('Content-type: image/jpeg');
$nofoto='images/no.jpg';
// Se obtienen las nuevas dimensiones
$percent = 0.3750;
list($width, $height) = getimagesize($nofoto);
$newwidth = $width * $percent;
$newheight = $height * $percent;
$thumb = imagecreate($newwidth, $newheight);
$source = imagecreatefromjpeg($nofoto);
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
imagejpeg($thumb);
exit();}"
Esto es facil: estoy tomando una foto del dominio: http://www.autocasionextremadura.com/images/no.jpg
Ahora el problema: si hay foto:
if ($im !== false) {
header('Content-type: image/jpeg');
imagejpeg($im);
//$im=ImageJpeg($im);
// Se obtienen las nuevas dimensiones
$percent = 0.3750;
list($width, $height) = getimagesize($im);
$newwidth = $width * $percent;
$newheight = $height * $percent;
// Cargar la imagen
$thumb = imagecreate($newwidth, $newheight);
$source = imagecreatefromjpeg($im);
// Redimensionar
imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $width, $height);
// Mostrar la nueva imagen
ImageJpeg($thumb);
exit(); } No me está funcionando.
El planteamiento de imagecopyresized() es tomar un archivo y procesarlo.
Se puede producir un archivo en el servidor, procesarlo, mostrarlo y eliminarlo.
¿Se puede trabajar con el stream binario y lograr l mismo resultado?
Basicamente, solicito orientacion para lograr hacer funcionar ese segundo condicional.
Un saludo.