Ver Mensaje Individual
  #1 (permalink)  
Antiguo 09/12/2005, 14:52
Quinti
 
Fecha de Ingreso: agosto-2005
Mensajes: 6
Antigüedad: 18 años, 8 meses
Puntos: 0
Pregunta thumbs con GD, pero: si la extension no es .jpg, crealo.

Hola

bueno,
os comento:

estoy usando un cms de galería de fotos que usa flash, php y mysql, este: http://pg.notacube.com/main.php

subes la imagen y te crea un thumb, con esta funcion, usa GD:

Código PHP:
function createThumb($image$newname){    
    
$size getimagesize ($image);    
    
$height $size[1];
    
$width $size[0];
    
    if (
$width $height) {
        
$newwidth 80;
        
$newheight round(($height*80)/$width);
    } else {
        
$newheight 80;
        
$newwidth round(($width*80)/$height);    
    }
        
    
$src imagecreatefromjpeg("$image");
    
$im imagecreatetruecolor($newwidth,$newheight);
    
imagecopyresampled($im,$src,0,0,0,0,$newwidth,$newheight,$width,$height);
    
imagejpeg($im$newname,50);
    
imagedestroy($im);

la cuestion es que sólo coge archivos .jpg, y yo quiero subir un .swf,
y lo sube, pero claro, crea un thumb con extension .swf,
y me sale esta información, (auqnue el swf lo traga, y el thumb.swf lo crea, pero claro, un cuadrado negro):


Código PHP:
Warningimagecreatefromjpeg() [function.imagecreatefromjpeg]: gd-jpegJPEG library reports unrecoverable errorin /home/html/galeria/_admin/imagenes.php on line 20

Warning
imagecreatefromjpeg() [function.imagecreatefromjpeg]: '../imagenes/transformaciones/prob12.swf' is not a valid JPEG file in /home/html/galeria/_admin/imagenes.php on line 20

Warning
imagecopyresampled(): supplied argument is not a valid Image resource in /home/html/galeria/_admin/imagenes.php on line 22 
mmm...la cuestion es que, cómo puedo hacer para que, subiendo un archivo .swf, cree un thumb con extension .jpg? éste thumb sería un archivo corrupto, pero luego yo lo subiría correctamente, me entendeis?, lo que quiero es que al menos cree una ruta a un thumb .jpg...

entonces, se me ocurre: en caseropseudocódigo:
"si el archivo es .swf, o no es .jpg, el thumb que sea .jpg" ó, "el thumb, pase lo q pase, q sea .jpg"

a alguien se le ocurre algo?
muchísimas gracias