28 lines
		
	
	
		
			735 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			735 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?
 | 
						|
 if($idf) {
 | 
						|
    require ("open_db_prod.php" );
 | 
						|
 | 
						|
    $query = "SELECT Imagen, filetype FROM productos WHERE id=".$idf;
 | 
						|
    $res = mysql_query($query, $conexion) or die("ERROR BUSCANDO IMAGEN");
 | 
						|
 | 
						|
	    $data = mysql_result($res,0,'Imagen');
 | 
						|
	    $type = mysql_result($res,0,'filetype');
 | 
						|
	    mysql_free_result($res);
 | 
						|
	    mysql_close($conexion);
 | 
						|
    if ( !empty( $type) )
 | 
						|
    {
 | 
						|
	    Header( "Content-type: $type" );
 | 
						|
	    echo $data;
 | 
						|
    } else {
 | 
						|
	    Header("Content-type: image/gif"); 
 | 
						|
 | 
						|
	    $fp = fopen("prod/images/simagen.gif","rb"); 
 | 
						|
	    $file = fread($fp,filesize("prod/images/simagen.gif")); 
 | 
						|
	    fclose($fp); 
 | 
						|
 | 
						|
	    echo $file;   
 | 
						|
    }
 | 
						|
  } else {
 | 
						|
   echo "<META CONTENT=\"0; URL=error.htm\" HTTP-EQUIV=\"REFRESH\">";
 | 
						|
  }
 | 
						|
?> 
 |